class_docstr: Single-dispatch generic method descriptor.
  
  Supports wrapping existing descriptors and handles non-descriptor
  callables as instance methods.
class_docstr_tok: ["Single-dispatch","generic","method","descriptor",".","Supports","wrapping","existing","descriptors","and","handles","non-descriptor","callables","as","instance","methods","."]
code: def __init__(self, func):
      if not callable(func) and not hasattr(func, "__get__"):
          raise TypeError(f"{func!r} is not callable or a descriptor")
  
      self.dispatcher = singledispatch(func)
      self.func = func
  
      import weakref  # see comment in singledispatch function
  
      self._method_cache = weakref.WeakKeyDictionary()
  
imports: from abc import get_cache_token
  from collections import namedtuple
  from reprlib import recursive_repr
  from _thread import RLock
label_desc: Use image node_id 1 to create a new singledispatchmethod object  with example: obj = singledispatchmethod(func)