def dict_from_dir(obj, keys_to_ignore=None, keys_to_show="all"):

    if keys_to_ignore is None:
        keys_to_ignore = []
    elif isinstance(keys_to_ignore, basestring):
        keys_to_ignore = [keys_to_ignore]

    ret = {}

    if keys_to_show != "all":
        for key in keys_to_show:
            ret[key] = getattr(obj, key)

        return ret


    for k in dir(obj):
        pass

        if k.startswith("_"):
            pass
        elif keys_to_ignore in k:
            pass

        # hide sqlalchemy stuff
        elif k in ["query", "query_class", "metadata"]:
            pass
        else:
            value = getattr(obj, k)
            if not callable(value):
                ret[k] = value

    return ret
dataset/ETHPy150Open Impactstory/total-impact-webapp/util.py/dict_from_dir/swapped operands of `in`