code: def dataio_prep(hparams):
      """This function prepares the datasets to be used in the brain class.
      It also defines the data processing pipeline through user-defined functions.
      We expect `prepare_mini_librispeech` to have been called before this,
      so that the `train.json`, `valid.json`,  and `valid.json` manifest files
      are available.
  
      Arguments
      ---------
      hparams : dict
          This dictionary is loaded from the `train.yaml` file, and it includes
          all the hyperparameters needed for dataset construction and loading.
  
      Returns
      -------
      datasets : dict
          Contains two keys, "train" and "valid" that correspond
          to the appropriate DynamicItemDataset object.
      """
  
      # Define audio pipeline
      @sb.utils.data_pipeline.takes("file_name")
      @sb.utils.data_pipeline.provides("sig")
      def audio_pipeline(wav):
          """Load the signal, and output it"""
          return read_audio(wav, hparams)
  
      @sb.utils.data_pipeline.takes("digit", "speaker_id")
      @sb.utils.data_pipeline.provides("digit_label", "speaker_label")
      def labels_pipeline(digit, speaker_id):
          yield int(digit)
          yield int(speaker_id) - 1
  
      # Define datasets. We also connect the dataset with the data processing
      # functions defined above.
  
      dataset_splits = load_dataset(hparams)
      dataset_splits_values = dataset_splits.values()
  
      output_keys = ["file_name", "sig", "digit_label", "speaker_label"]
      if "done_detector" in hparams:
          output_keys += ["file_name_random", "sig_random"]
  
      sb.dataio.dataset.set_output_keys(
          dataset_splits_values,
          output_keys,
      )
      sb.dataio.dataset.add_dynamic_item(
          dataset_splits_values, audio_pipeline
      )
      sb.dataio.dataset.add_dynamic_item(
          dataset_splits_values, labels_pipeline
      )
      for dataset_split in dataset_splits_values:
          enhance_with_random(dataset_split, hparams)
  
      train_split = dataset_splits["train"]
      data_count = None
      train_split = apply_overfit_test(
          hparams["overfit_test"],
          hparams["overfit_test_sample_count"],
          hparams["overfit_test_epoch_data_count"],
          train_split,
      )
  
      if hparams["train_data_count"] is not None:
          data_count = hparams["train_data_count"]
          train_split.data_ids = train_split.data_ids[:data_count]
      dataset_splits["train"] = train_split
  
      return dataset_splits
  
imports: import logging
  import sys
  import torch
  import speechbrain
  import os
  from collections import namedtuple
  from audiomnist_prepare import prepare_audiomnist
  from hyperpyyaml import load_hyperpyyaml
  from torchaudio import functional
  from speechbrain.dataio.dataio import length_to_mask, write_audio
  from speechbrain.dataio.dataset import apply_overfit_test
  from speechbrain.utils import data_utils
  from speechbrain.utils.train_logger import plot_spectrogram
  from enum import Enum
  from speechbrain.utils.distributed import run_on_main
  from speechbrain.utils.data_utils import dict_value_combinations, dist_stats, masked_mean, masked_min, masked_max, masked_std, match_shape
label_desc: Use image node_id 4 for calling a global function with example usage: dataio_prep(hparams) and returns: dataset_splits, read_audio