docs: def global_hook(handler):
      """add a callback to run in every switch between coroutines
  
      :param handler:
          the callback function, must be a function taking 2 arguments:
  
          - the greenlet being switched from
          - the greenlet being switched to
  
          be aware that only a weak reference to this function will be held.
      :type handler: function
      """
      if not hasattr(handler, "__call__"):
          raise TypeError("trace hooks must be callable")
  
      log.info("setting a new global hook callback")
      state.global_hooks.append(weakref.ref(handler))
  
      return handler