code: def add_method(self, f=None, name=None):
          
          if name and not f:
              return functools.partial(self.add_method, name=name)
  
          self.method_map[name or f.__name__] = f
          return f
docs: Add a method to the dispatcher.
  
          Parameters
          ----------
          f : callable
              Callable to be added.
          name : str, optional
              Name to register (the default is function **f** name)
  
          Notes
          -----
          When used as a decorator keeps callable object unmodified.
  
          Examples
          --------
  
          Use as method
  
          >>> d = Dispatcher()
          >>> d.add_method(lambda a, b: a + b, name="sum")
          <function __main__.<lambda>>
  
          Or use as decorator
  
          >>> d = Dispatcher()
          >>> @d.add_method
              def mymethod(*args, **kwargs):
                  print(args, kwargs)
  
          Or use as a decorator with a different function name
          >>> d = Dispatcher()
          >>> @d.add_method(name="my.method")
              def mymethod(*args, **kwargs):
                  print(args, kwargs)