code: def _add_hookimpl(self, hookimpl):
          
          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
docs: Add an implementation to the callback chain.