def class2dict(f):
    return dict(((name, getattr(f, name)) for name in dir(f) if (not name.startswith('__'))))
def class2dict(f):
    return dict(((name, getattr(f, name)) for name in dir(f) if (not name.startswith('__'))))