class_docstr: Adapter that handles python generators and iterators.
class_docstr_tok: ["Adapter","that","handles","python","generators","and","iterators","."]
code: def _peek_and_restore(x):
      peek = next(x)
      return peek, itertools.chain([peek], x)
  
file_path: elegy/elegy/data/generator_adapter.py
imports: import itertools
  import typing
  from .data_adapter import DataAdapter
  from .utils import assert_not_namedtuple, flatten, is_none_or_empty, pack_x_y_sample_weight, unpack_x_y_sample_weight
label_desc: Use image node_id 4 for calling the GeneratorDataAdapter obj's underlying member method code with example usage: obj._peek_and_restore(x) and returns: peek,  itertools