Return an async context manager that calls the aclose() method of thing upon completion of the block. This is basically equivalent to:
contextlib.aclosing(thing)
from contextlib import asynccontextmanager
@asynccontextmanager
async def aclosing(thing):
try:
yield thing
finally:
await thing.aclose()
from contextlib import aclosing
async with aclosing(my_generator()) as values:
async for value in values:
if value == 42:
break