def allbindings(obj):
    """ return dict with all attrname/obj bindings for a given obj.

        note that using the builtin vars() would not give the attributes 
        of base classes whereas calling 'dir()' gives the names 
        of inherited attributes. 
    """
    d = {}
    for name in dir(obj):
        try:
            d[name] = getattr(obj, name)
        except:
            pass
    return d
