An asynchronous context manager, similar to ExitStack, that supports combining both synchronous and asynchronous context managers, as well as having coroutines for cleanup logic.
class contextlib.AsyncExitStack
async with AsyncExitStack() as stack:
connections = [await stack.enter_async_context(get_connection())
for i in range(5)]
All opened connections will automatically be released at the end of
the async with statement, even if attempts to open a connection
later in the list raise an exception.