def METHOD_NAME(obj):
    type_ = object.__getattribute__(obj, '__class__')
    if type_ is _oldstyle_instance_type:
        # Somehow for old style classes we need to access it directly.
        return obj.__class__
    return type_