code: def is_method(arg):
      
      if inspect.ismethod(arg):
          return True
      if isinstance(arg, NonInstanceMethod):
          return True
  
      # Unfortunately, there is no disctinction between instance methods
      # that are yet to become part of a class, and regular functions.
      # We attempt to evade this little gray zone by relying on extremely strong
      # convention (which is nevertheless _not_ enforced by the intepreter)
      # that first argument of an instance method must be always named ``self``.
      if inspect.isfunction(arg):
          return _get_first_arg_name(arg) == 'self'
  
      return False
docs: Checks whether given object is a method.