def get_class(func):
    try:
        return func.im_class
    except AttributeError:
        return func.__self__.__class__
def get_class(func):
    try:
        return func.im_class
    except AttributeError:
        return func.__self__.__class__