async def _deliver_event(self, func: Callable[([Event], Any)], event: Event) -> None:
    try:
        retval = func(event)
        if iscoroutine(retval):
            (await retval)
    except BaseException:
        self._logger.exception('Error delivering %s event', event.__class__.__name__)
async def _deliver_event(self, func: Callable[([Event], Any)], event: Event) -> None:
    try:
        retval = func(event)
        if iscoroutine(retval):
            (await retval)
    except BaseException:
        self._logger.exception('Error delivering %s event', event.__class__.__name__)