code: def pop_event(self, event_name, timeout=DEFAULT_TIMEOUT):
          
          if not self.started:
              raise IllegalStateError(
                  "Dispatcher needs to be started before popping.")
  
          e_queue = self.get_event_q(event_name)
  
          if not e_queue:
              raise TypeError("Failed to get an event queue for {}".format(
                  event_name))
  
          try:
              # Block for timeout
              if timeout:
                  return e_queue.get(True, timeout)
              # Non-blocking poll for event
              elif timeout == 0:
                  return e_queue.get(False)
              else:
                  # Block forever on event wait
                  return e_queue.get(True)
          except queue.Empty:
              raise queue.Empty('Timeout after {}s waiting for event: {}'.format(
                  timeout, event_name))
docs: Pop an event from its queue.
  
          Return and remove the oldest entry of an event.
          Block until an event of specified name is available or
          times out if timeout is set.
  
          Args:
              event_name: Name of the event to be popped.
              timeout: Number of seconds to wait when event is not present.
                  Never times out if None.
  
          Returns:
              The oldest entry of the specified event. None if timed out.
  
          Raises:
              IllegalStateError: Raised if pop is called before the dispatcher
                  starts polling.