def dir_dict(obj, raise_exc=False):
    # TODO: separate function for handling descriptors on types?
    ret = {}
    for k in dir(obj):
        try:
            ret[k] = getattr(obj, k)
        except Exception:
            if raise_exc:
                raise
    return ret
Return a dictionary of attribute names to values for a given
dataset/ETHPy150Open mahmoud/boltons/boltons/funcutils.py/dir_dict