def get_class(obj):
    '''Retrives the class of the given object.

    unfortunately, it seems there's no single way to query class that works in
    all cases - .__class__ doesn't work on some builtin-types, like
    re._pattern_type instances, and type() doesn't work on old-style
    classes... 
    '''
    cls = type(obj)
    if cls == types.InstanceType:
        cls = obj.__class__
    return cls
Retrives the class of the given object.

    unfortunately, it seems there's no single way to query class that works in
    all cases - .__class__ doesn't work on some builtin-types, like
    re._pattern_type instances, and type() doesn't work on old-style
    classes... 
    
recipes/Python/578305_Find_what_class_attribute__ie_myObjmyAttr_/recipe-578305.py