code: def item_iter(
      manifests_files: Union[str, List[str]],
      parse_func: Callable[[str, Optional[str]], Dict[str, Any]] = None,
  ) -> Iterator[Dict[str, Any]]:
      """Iterate through json lines of provided manifests.
  
      NeMo ASR pipelines often assume certain manifest files structure. In
      particular, each manifest file should consist of line-per-sample files with
      each line being correct json dict. Each such json dict should have a field
      for audio file string, a field for duration float and a field for text
      string. Offset also could be additional field and is set to None by
      default.
  
      Args:
          manifests_files: Either single string file or list of such -
              manifests to yield items from.
  
          parse_func: A callable function which accepts as input a single line
              of a manifest and optionally the manifest file itself,
              and parses it, returning a dictionary mapping from str -> Any.
  
      Yields:
          Parsed key to value item dicts.
  
      Raises:
          ValueError: If met invalid json line structure.
      """
  
      if isinstance(manifests_files, str):
          manifests_files = [manifests_files]
  
      if parse_func is None:
          parse_func = __parse_item
  
      k = -1
      logging.debug("Manifest files: %s", str(manifests_files))
      for manifest_file in manifests_files:
          logging.debug("Using manifest file: %s", str(manifest_file))
          cached_manifest_file = DataStoreObject(manifest_file).get()
          logging.debug("Cached at: %s", str(cached_manifest_file))
          with open(expanduser(cached_manifest_file), "r") as f:
              for line in f:
                  k += 1
                  item = parse_func(line, manifest_file)
                  item["id"] = k
  
                  yield item
  
file_path: NeMo/nemo/collections/common/parts/preprocessing/manifest.py
imports: import json
  import os
  import re
  from os.path import expanduser
  from typing import Any, Callable, Dict, Iterator, List, Optional, Union
  from nemo.utils import logging
  from nemo.utils.data_utils import DataStoreObject, datastore_path_to_local_path, is_datastore_path
  from nemo.utils.nemo_logging import LogMode
label_desc: Use image node_id 1 for calling a global function with example usage: item_iter(manifests_files, parse_func) without return types