async def sane_wait_for(futures, *, timeout):
    ensured = [asyncio.ensure_future(fut) for fut in futures]
    (done, pending) = (await asyncio.wait(ensured, timeout=timeout, return_when=asyncio.ALL_COMPLETED))
    if (len(pending) != 0):
        raise asyncio.TimeoutError()
    return done
async def sane_wait_for(futures, *, timeout):
    ensured = [asyncio.ensure_future(fut) for fut in futures]
    (done, pending) = (await asyncio.wait(ensured, timeout=timeout, return_when=asyncio.ALL_COMPLETED))
    if (len(pending) != 0):
        raise asyncio.TimeoutError()
    return done