def csv(cls,
            d,
            order=None,
            header=None,
            sort_keys=True):
        first_element = list(d)[0]
        def _keys():
            return list(d[first_element])
        def _get(element, key):
            try:
                tmp = str(d[element][key])
            except:
                tmp = ' '
            return tmp
        if d is None or d == {}:
            return None
        if order is None:
            order = _keys()
        if header is None and order is not None:
            header = order
        elif header is None:
            header = _keys()
        table = ""
        content = []
        for attribute in order:
            content.append(attribute)
        table = table + ",".join([str(e) for e in content]) + "\n"
        for job in d:
            content = []
            for attribute in order:
                try:
                    content.append(d[job][attribute])
                except:
                    content.append("None")
            table = table + ",".join([str(e) for e in content]) + "\n"
        return table