code: def __parse_item(line: str, manifest_file: str) -> Dict[str, Any]:
      item = json.loads(line)
  
      # Audio file
      if "audio_filename" in item:
          item["audio_file"] = item.pop("audio_filename")
      elif "audio_filepath" in item:
          item["audio_file"] = item.pop("audio_filepath")
  
      # Video File
      if "video_filename" in item:
          item["video_file"] = item.pop("video_filename")
      elif "video_filepath" in item:
          item["video_file"] = item.pop("video_filepath")
  
      if "video_file" not in item and "audio_file" not in item:
          raise ValueError(
              f"Manifest file {manifest_file} has invalid json line structure: {line} without proper audio/video file key."
          )
  
      # If the audio/video path is a relative path and does not exist,
      # try to attach the parent directory of manifest to the audio path.
      # Revert to the original path if the new path still doesn't exist.
      # Assume that the audio path is like "wavs/xxxxxx.wav".
      if "audio_file" in item:
          item["audio_file"] = get_full_path(
              audio_file=item["audio_file"], manifest_file=manifest_file
          )
      if "video_file" in item:
          item["video_file"] = get_full_path(
              audio_file=item["video_file"], manifest_file=manifest_file
          )
  
      # Duration.
      if "duration" not in item:
          raise ValueError(
              f"Manifest file {manifest_file} has invalid json line structure: {line} without proper duration key."
          )
  
      # Text.
      if "text" in item:
          pass
      elif "text_filepath" in item:
          with open(item.pop("text_filepath"), "r") as f:
              item["text"] = f.read().replace("\n", "")
      elif "normalized_text" in item:
          item["text"] = item["normalized_text"]
      else:
          item["text"] = ""
  
      # Optional RTTM file
      if "rttm_file" in item:
          pass
      elif "rttm_filename" in item:
          item["rttm_file"] = item.pop("rttm_filename")
      elif "rttm_filepath" in item:
          item["rttm_file"] = item.pop("rttm_filepath")
      else:
          item["rttm_file"] = None
      if item["rttm_file"] is not None:
          item["rttm_file"] = get_full_path(
              audio_file=item["rttm_file"], manifest_file=manifest_file
          )
  
      # Optional audio feature file
      if "feature_file" in item:
          pass
      elif "feature_filename" in item:
          item["feature_file"] = item.pop("feature_filename")
      elif "feature_filepath" in item:
          item["feature_file"] = item.pop("feature_filepath")
      else:
          item["feature_file"] = None
      if item["feature_file"] is not None:
          item["feature_file"] = get_full_path(
              audio_file=item["feature_file"],
              manifest_file=manifest_file,
          )
  
      item = dict(
          audio_file=item.get("audio_file", None),
          video_file=item.get("video_file", None),
          duration=item["duration"],
          text=item["text"],
          rttm_file=item["rttm_file"],
          feature_file=item["feature_file"],
          offset=item.get("offset", None),
          speaker=item.get("speaker", None),
          orig_sr=item.get("orig_sample_rate", None),
          token_labels=item.get("token_labels", None),
          lang=item.get("lang", None),
      )
      return 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 2 for calling a global function with example usage: __parse_item(line, manifest_file) and returns: item