class_docstr: New function with partial application of the given arguments
  and keywords.
class_docstr_tok: ["New","function","with","partial","application","of","the","given","arguments","and","keywords","."]
code: def __setstate__(self, state):
      if not isinstance(state, tuple):
          raise TypeError("argument to __setstate__ must be a tuple")
      if len(state) != 4:
          raise TypeError(
              f"expected 4 items in state, got {len(state)}"
          )
      func, args, kwds, namespace = state
      if (
          not callable(func)
          or not isinstance(args, tuple)
          or (kwds is not None and not isinstance(kwds, dict))
          or (namespace is not None and not isinstance(namespace, dict))
      ):
          raise TypeError("invalid partial state")
  
      args = tuple(args)  # just in case it's a subclass
      if kwds is None:
          kwds = {}
      elif (
          type(kwds) is not dict
      ):  # XXX does it need to be *exactly* dict?
          kwds = dict(kwds)
      if namespace is None:
          namespace = {}
  
      self.__dict__ = namespace
      self.func = func
      self.args = args
      self.keywords = kwds
  
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 5 for calling the partial obj's underlying member method code with example usage: obj.__setstate__(state) without return types