code: def prepare_fisher_callhome_spanish(
      data_folder: str, save_folder: str, device: str = "cpu"
  ):
      """
      Prepares the json files for the Mini Fisher-Callhome-Spanish dataset.
      Arguments
      ---------
      data_folder : str
          Path to the folder where the Fisher-Callhome-Spanish dataset is stored.
      save_folder: str:
          Path of train/valid/test specification file will be saved.
      Example
      -------
      >>> data_folder = '/path/to/fisher-callhome'
      >>> save_foler = 'data'
      >>> prepare_fisher_callhome_spanish(data_folder, save_folder)
      """
  
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
  
      # If the dataset doesn't exist yet, terminate the whole program
      speech_folder = os.path.join(
          f"{data_folder}/LDC2010S01/data/speech"
      )
      transcription_folder = os.path.join(
          f"{data_folder}/LDC2010T04/fisher_spa_tr/data/transcripts"
      )
  
      if check_folders(speech_folder, transcription_folder) is not True:
          logger.error(
              "Speech or transcription directories are missing or not properly organised within the speech data dir"
              "Typical format is LDC2010S01/data/speech and LDC2010T04/fisher_spa_tr/data/transcripts"
          )
          return
  
      datasets = ["dev", "dev2", "test", "train"]
  
      corpus_path = f"{save_folder}/fisher-callhome-corpus"
      download_translations(path=corpus_path)
  
      make_data_splits(
          f"{corpus_path}/mapping"
      )  # make splitted data list from mapping files
  
      for dataset in datasets:
          if not os.path.exists(f"{save_folder}/{dataset}/wav"):
              os.makedirs(f"{save_folder}/{dataset}/wav")
  
          if skip(save_folder, dataset):
              logger.info(
                  f"Skipping preparation of {dataset}, completed in previous run."
              )
              continue
  
          # get file lists
          transcription_files = get_transcription_files_by_dataset(
              dataset, transcription_folder=transcription_folder
          )
  
          # extract all transcriptions from files
          extracted_transcriptions = {}
          for transcription_file in transcription_files:
              filename = transcription_file.split("/")[-1].split(".")[0]
              extracted_transcriptions[
                  filename
              ] = extract_transcription(transcription_file)
  
          # concate short utterance via mapping file
          concated_data = concate_transcriptions_by_mapping_file(
              speech_folder=speech_folder,
              mapping_file_path=f"{corpus_path}/mapping/fisher_{dataset}",
              extracted_transcriptions=extracted_transcriptions,
          )
  
          # get translation through fisher-callhome-corpus
          if dataset != "train":
              # dev, dev2, test got four translations
              for number in range(4):
                  translation_path = f"{corpus_path}/corpus/ldc/fisher_{dataset}.en.{number}"
                  translations = get_translations_from_path(
                      translation_path
                  )
  
                  concated_data = (
                      insert_translation_into_existing_dataset(
                          data=concated_data, translations=translations
                      )
                  )
          else:
              translation_path = (
                  f"{corpus_path}/corpus/ldc/fisher_{dataset}.en"
              )
              translations = get_translations_from_path(
                  translation_path
              )
              concated_data = insert_translation_into_existing_dataset(
                  data=concated_data, translations=translations
              )
  
          # filter out empty or long transcription/translation
          concated_data = list(
              filter(
                  lambda data: 0 < len(data.transcription) < 400,
                  concated_data,
              )
          )
  
          if dataset == "train":
              concated_data = list(
                  filter(
                      lambda data: 0 < len(data.translations[0]) < 400,
                      concated_data,
                  )
              )
          else:
              for number in range(4):
                  concated_data = list(
                      filter(
                          lambda data: 0
                          < len(data.translations[number])
                          < 400,
                          concated_data,
                      )
                  )
  
          # ignore empty or long utterances
          concated_data = list(
              filter(lambda data: 0 < data.duration < 30, concated_data)
          )
  
          # sort by utterance id
          concated_data = sorted(
              concated_data, key=lambda data: data.uid
          )
  
          # store transcription/translation/wav files
          data_dict = {}
          for data in tqdm(
              concated_data, desc=f"pre-processing [{dataset}]"
          ):
              wav_save_path = (
                  f"{save_folder}/{dataset}/wav/{data.uid}.wav"
              )
              # prepare audio files
              wav_information = data.wav.split(" ")
              segment_audio(
                  audio_path=wav_information[0],
                  channel=int(wav_information[1]),
                  start=int(wav_information[2]),
                  end=int(wav_information[3]),
                  save_path=wav_save_path,
                  sample_rate=SAMPLE_RATE,
                  device=device,
              )
  
              # prepare json file
              if dataset != "train":
                  data_dict[data.uid] = {
                      "wav": "{data_root}"
                      + f"/{dataset}/wav/{data.uid}.wav",
                      "duration": data.duration,
                      "transcription": data.transcription,
                  }
  
                  for number in range(4):
                      translation_dict = {
                          f"translation_{number}": data.translations[
                              number
                          ]
                      }
                      data_dict[data.uid].update(translation_dict)
              else:
                  data_dict[data.uid] = {
                      "wav": "{data_root}"
                      + f"/{dataset}/wav/{data.uid}.wav",
                      "duration": data.duration,
                      "transcription": data.transcription,
                      "translation_0": data.translations[0],
                      "transcription_and_translation": f"{data.transcription}\n{data.translations[0]}",
                  }
  
          # save json
          json_path = f"{save_folder}/{dataset}/data.json"
          with open(json_path, "w", encoding="utf-8") as data_json:
              json.dump(
                  data_dict, data_json, indent=2, ensure_ascii=False
              )
  
          logger.info(f"{json_path} successfully created!")
  
imports: import os
  import re
  import json
  import string
  import logging
  import subprocess
  from typing import List
  from dataclasses import dataclass, field
  import torch
  import torchaudio
  from tqdm import tqdm
  from speechbrain.utils.data_utils import get_all_files
  from speechbrain.utils.torch_audio_backend import check_torchaudio_backend
  from speechbrain.augment.time_domain import Resample
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_fisher_callhome_spanish(data_folder, save_folder, device) without return types