code: def process_events(self):
          
          for event, args in iter_except(self.event_queue.popleft, IndexError):
              for callback in self.event_callbacks[event]:
                  callback(*args)
docs: Processes any events in the queue.