code: def generator_iterator(fn):
      """Turn a generator into a GeneratorIterator-wrapped function.
      Effectively this allows iterating over a generator multiple times by recording
      the call arguments, and calling the generator with them anew each item __iter__
      is called on the returned object."""
  
      @functools.wraps(fn)
      def wrapped(*args, **kwargs):
          return GeneratorIterator(fn, *args, **kwargs)
  
      return wrapped
  
imports: import functools
  import itertools
  import math
  import random
  from typing import Any, Dict, Iterable, List, MutableMapping, NamedTuple, Optional, Type
  from pytext.common.constants import RawExampleFieldName, Stage
  from pytext.config.component import Component, ComponentType, create_component, Registry
  from pytext.utils.usage import log_class_usage
  from .sources import DataSource, RawExample, TSVDataSource
  from .sources.data_source import GeneratorIterator, RowShardedDataSource, ShardedDataSource
  from .tensorizers import initialize_tensorizers, MetricTensorizer, Tensorizer
label_desc: Use image node_id 3 for calling a global function with example usage: generator_iterator(fn) and returns: wrapped, GeneratorIterator