code: def mainthread_data_iterator(
      ds: Dataset, batched_indices: tp.List[tp.List[int]]
  ) -> tp.Iterable[tp.Any]:
      """Generator that loads datasamples from the data set in the main thread"""
      for batch_of_indices in batched_indices:
          samples = list(map(ds.__getitem__, batch_of_indices))
          yield get_batch_fn(ds)(samples)
  
imports: import multiprocessing.pool
  import os
  import typing
  import jax
  import jax.numpy
  import numpy
  from .data_adapter import DataAdapter
  from .utils import is_none_or_empty
label_desc: Use image node_id 3 for calling a global function with example usage: mainthread_data_iterator(ds, batched_indices) without return types