from typing import Awaitable
import asyncio


async def wait_one(*tasks: Awaitable):
    """
    Either return result of the first completed task or raise its exception.

    wait_one will return as soon as any of tasks completes:

    >>> async def run():
    >>>     task_1 = ...
    >>>     task_2 = ...
    >>>     await wait_one(task_1, task_2)
    >>>     assert task_1.done() or task_2.done()
    """
    try:
        return await next(asyncio.as_completed(tasks))
    except:
        raise