def is_unbound_method(fn):
 is_bound = is_bound_method(fn)
 if ((not is_bound) and inspect.isroutine(fn)):
  spec = getargspec(fn)
  has_self = ((len(spec.args) > 0) and (spec.args[0] == 'self'))
  if (PY2 and inspect.ismethod(fn)):
   return True
  elif (inspect.isfunction(fn) and has_self):
   return True
 return False

def is_unbound_method ( fn ) : is_bound = is_bound_method ( fn ) if ( ( not is_bound ) and inspect . isroutine ( fn ) ) : spec = getargspec ( fn ) has_self = ( ( len ( spec . args ) > 0 ) and ( spec . args [ 0 ] == 'self' ) ) if ( PY2 and inspect . ismethod ( fn ) ) : return True elif ( inspect . isfunction ( fn ) and has_self ) : return True return False
this consistently verifies that the callable is bound to a class .