code: def aitercontext(aiterable, *, cls=AsyncIteratorContext):
      
      assert issubclass(cls, AsyncIteratorContext)
      aiterator = aiter(aiterable)
      if isinstance(aiterator, cls):
          return aiterator
      return cls(aiterator)
docs: Return an asynchronous context manager from an asynchronous iterable.
  
      The context management makes sure the aclose asynchronous method
      has run before it exits. It also issues warnings and RuntimeError
      if it is used incorrectly.
  
      It is safe to use with any asynchronous iterable and prevent
      asynchronous iterator context to be wrapped twice.
  
      Correct usage::
  
          ait = some_asynchronous_iterable()
          async with aitercontext(ait) as safe_ait:
              async for item in safe_ait:
                  <block>
  
      An optional subclass of AsyncIteratorContext can be provided.
      This class will be used to wrap the given iterable.