1import inspect 2 3def requires_self(func): 4 func_argc = len(inspect.getargspec(func).args) 5 if func_argc == 0 or ( 6 getattr( 7 func, 8 'im_self', 9 None) is not None) or ( 10 hasattr( 11 func, 12 '__self__')): 13 return False 14 else: 15 return True 16