code: def num_listeners(self, event=None):
          
          if event is not None:
              return len(self._listeners[event])
          else:
              return sum(len(l) for l in self._listeners.values())
docs: Return the number of listeners for ``event``.
  
          Return the total number of listeners for all events on this object if
          ``event`` is :class:`None`.