import asyncio


def create_checked_task(coro_or_future):
    """
    Wrapper for `asyncio.ensure_future` that always propagates exceptions.
    """

    def raise_any_exc(task):
        return task.result()

    task = asyncio.ensure_future(coro_or_future)
    task.add_done_callback(raise_any_exc)
    return task