docstr: Add an implementation to the callback chain.
          
docstr_tok: ["Add","an","implementation","to","the","callback","chain","."]
code: def _add_hookimpl(self, hookimpl):
      """Add an implementation to the callback chain."""
      if hookimpl.hookwrapper:
          methods = self._wrappers
      else:
          methods = self._nonwrappers
  
      if hookimpl.trylast:
          methods.insert(0, hookimpl)
      elif hookimpl.tryfirst:
          methods.append(hookimpl)
      else:
          # find last non-tryfirst method
          i = len(methods) - 1
          while i >= 0 and methods[i].tryfirst:
              i -= 1
          methods.insert(i + 1, hookimpl)
  
      if "__multicall__" in hookimpl.argnames:
          warnings.warn(
              "Support for __multicall__ is now deprecated and will be"
              "removed in an upcoming release.",
              DeprecationWarning,
          )
          self.multicall = _legacymulticall
  
imports: import inspect
  import sys
  import warnings
  from .callers import _legacymulticall, _multicall
label_desc: Use image node_id 7 for calling the _HookCaller obj's underlying member method code with example usage: obj._add_hookimpl(hookimpl) without return types