docs: def has_event_handler(self, handler, event_name=None):
          """Check if the specified event has the specified handler.
  
          Args:
              handler (callable): the callable event handler.
              event_name: The event the handler attached to. Set this
                  to ``None`` to search all events.
          """
          if event_name is not None:
              if event_name not in self._event_handlers:
                  return False
              events = [event_name]
          else:
              events = self._event_handlers
          for e in events:
              for h, _, _ in self._event_handlers[e]:
                  if h == handler:
                      return True
          return False