<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register(self, event, keys):
 """ Register a new event with available keys. Raises ValueError when the event has already been registered. Usage: dispatch.register("my_event", ["foo", "bar", "baz"]) """

        if self.running:
            raise RuntimeError("Can't register while running")
        handler = self._handlers.get(event, None)
        if handler is not None:
            raise ValueError("Event {} already registered".format(event))
        self._handlers[event] = EventHandler(event, keys, loop=self.loop)