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.
      """
  
      # Define audio piplines
      @sb.utils.data_pipeline.takes("noisy_wav")
      @sb.utils.data_pipeline.provides("noisy_sig")
      def noisy_pipeline(noisy_wav):
          noisy_wav = sb.dataio.dataio.read_audio(noisy_wav)
          return noisy_wav
  
      @sb.utils.data_pipeline.takes("clean_wav")
      @sb.utils.data_pipeline.provides("clean_sig")
      def clean_pipeline(clean_wav):
          clean_wav = sb.dataio.dataio.read_audio(clean_wav)
          return clean_wav
  
      # Define datasets
      datasets = {}
      data_info = {
          "train": hparams["train_annotation"],
          "valid": hparams["valid_annotation"],
          "test": hparams["test_annotation"],
      }
      for dataset in data_info:
          datasets[
              dataset
          ] = sb.dataio.dataset.DynamicItemDataset.from_json(
              json_path=data_info[dataset],
              replacements={"data_root": hparams["data_folder"]},
              dynamic_items=[noisy_pipeline, clean_pipeline],
              output_keys=["id", "noisy_sig", "clean_sig"],
          )
  
      # Sort train dataset
      if (
          hparams["sorting"] == "ascending"
          or hparams["sorting"] == "descending"
      ):
          datasets["train"] = datasets["train"].filtered_sorted(
              sort_key="length",
              reverse=hparams["sorting"] == "descending",
          )
          hparams["train_dataloader_opts"]["shuffle"] = False
      elif hparams["sorting"] != "random":
          raise NotImplementedError(
              "Sorting must be random, ascending, or descending"
          )
  
      return datasets
  
imports: import os
  import sys
  import torch
  import torchaudio
  import speechbrain
  from pesq import pesq
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.metric_stats import MetricStats
  from speechbrain.nnet.loss.stoi_loss import stoi_loss
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 2 for calling a global function with example usage: dataio_prep(hparams) and returns: datasets, noisy_wav, clean_wav