def on(  # pylint: disable=invalid-name
            self, event: str, *handlers: T.Callable
    ) -> T.Callable:
        """Registers one or more handlers to a specified event.
        This method may as well be used as a decorator for the handler."""

        def _on_wrapper(*handlers: T.Callable) -> T.Callable:
            """wrapper for on decorator"""
            self._events[event].extend(handlers)
            return handlers[0]

        if handlers:
            return _on_wrapper(*handlers)
        return _on_wrapper
def on ( self , event : str , * handlers : T . Callable ) -> T . Callable : def _on_wrapper ( * handlers : T . Callable ) -> T . Callable : self . _events [ event ] . extend ( handlers ) return handlers [ 0 ] if handlers : return _on_wrapper ( * handlers ) return _on_wrapper
Registers one or more handlers to a specified event.
        This method may as well be used as a decorator for the handler.