def register_pygame_handler(self, event, handler):
        if event not in self.registered_pygame_handlers:
            self.registered_pygame_handlers[event] = set()

        self.registered_pygame_handlers[event].add(handler)
        self.pygame_allowed_events.append(event)

        self.log.debug("Adding Window event handler. Event:%s, Handler:%s",
                       event, handler)

        pygame.event.set_allowed(self.pygame_allowed_events)
Registers a method to be a handler for a certain type of Pygame
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/media_controller.py/MediaController.register_pygame_handler