code: def methdispatch(func):
      """
      A decorator that is used to support singledispatch style functionality
      for instance methods. By default, singledispatch selects a function to
      call from registered based on the type of args[0]::
  
          def wrapper(*args, **kw):
              return dispatch(args[0].__class__)(*args, **kw)
  
      This uses singledispatch to do achieve this but instead uses `args[1]`
      since `args[0]` will always be self.
      """
  
      dispatcher = singledispatch(func)
  
      def wrapper(*args, **kw):
          return dispatcher.dispatch(args[1].__class__)(*args, **kw)
  
      wrapper.register = dispatcher.register
      update_wrapper(wrapper, dispatcher)
  
      return wrapper
  
file_path: alibi/alibi/utils/wrappers.py
imports: import numpy
  from functools import singledispatch, update_wrapper
label_desc: Use image node_id 1 for calling a global function with example usage: methdispatch(func) and returns: wrapper, dispatcher