code: def map_keys(batch, modalities=("rgb"), return_as_dict=False):
      """DMVR dataset returns 'image' and 'label'. We want 'inputs' and 'label'."""
      if not return_as_dict:
          if len(modalities) == 1 and modalities[0] == "rgb":
              batch["inputs"] = batch["image"]
          elif len(modalities) == 1 and modalities[0] == "spectrogram":
              batch["inputs"] = batch["spectrogram"]
          else:
              raise NotImplementedError(
                  "modality not supported by map_keys."
              )
      else:
          batch["inputs"] = {}
          if "rgb" in modalities:
              batch["inputs"]["rgb"] = batch["image"]
          if "spectrogram" in modalities:
              batch["inputs"]["spectrogram"] = batch["spectrogram"]
      return batch
  
imports: import functools
  from typing import Dict, Iterator, List, Optional, Text, Tuple, Union
  from absl import logging
  from dmvr import modalities
  from flax import jax_utils
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.dataset_lib import video_ops
  from scenic.projects.mbt.datasets.dataset_utils import add_spectrogram
  from scenic.projects.vivit.data import video_tfrecord_dataset
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: map_keys(batch, modalities, return_as_dict) and returns: batch