class_docstr: Method descriptor with partial application of the given arguments
  and keywords.
  
  Supports wrapping existing descriptors and handles non-descriptor
  callables as instance methods.
class_docstr_tok: ["Method","descriptor","with","partial","application","of","the","given","arguments","and","keywords",".","Supports","wrapping","existing","descriptors","and","handles","non-descriptor","callables","as","instance","methods","."]
code: def __init__(self, func, /, *args, **keywords):
      if not callable(func) and not hasattr(func, "__get__"):
          raise TypeError(
              "{!r} is not callable or a descriptor".format(func)
          )
  
      # func could be a descriptor like classmethod which isn't callable,
      # so we can't inherit from partial (it verifies func is callable)
      if isinstance(func, partialmethod):
          # flattening is mandatory in order to place cls/self before all
          # other arguments
          # it's also more efficient since only one function will be called
          self.func = func.func
          self.args = func.args + args
          self.keywords = {**func.keywords, **keywords}
      else:
          self.func = func
          self.args = args
          self.keywords = keywords
  
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 partialmethod object from inherited base classes: object with example: obj = partialmethod()