from typing import Awaitable
from typing import Any
import asyncio


def waitEvent(emitter, event_name: str) -> Awaitable[Any]:
    """
    Returns a future which resolves to the event's details when event_name is emitted from emitter
    :param emitter: emitter to attach callback to
    :param event_name: name of event to trigger callback
    :return: Awaitable[Any]
    """
    fut = asyncio.get_event_loop().create_future()

    def set_done(arg=None):
        fut.set_result(arg)

    emitter.once(event_name, set_done)
    return fut