code: def _next(iterator: t.Iterator[T]) -> T:
      # We can't raise `StopIteration` from within the threadpool iterator
      # and catch it outside that context, so we coerce them into a different
      # exception type.
      try:
          return next(iterator)
      except StopIteration:
          raise _StopIteration
  
imports: from __future__ import annotations
  import itertools
  import logging
  import typing
  from typing import TYPE_CHECKING
  import anyio
  from bentoml.exceptions import InvalidArgument
label_desc: Use image node_id 3 for calling a global function with example usage: _next(iterator) and returns: next