code: def prepare_dvoice(
      data_folder,
      save_folder,
      train_csv_file=None,
      dev_csv_file=None,
      test_csv_file=None,
      accented_letters=False,
      language="fongbe",
      skip_prep=False,
  ):
      if skip_prep:
          return
  
      # If not specified point toward standard location w.r.t DVoice tree
      if train_csv_file is None:
          train_csv_file = data_folder + "texts/train.csv"
      else:
          train_csv_file = train_csv_file
  
      if dev_csv_file is None:
          dev_csv_file = data_folder + "texts/dev.csv"
      else:
          dev_csv_file = dev_csv_file
  
      if test_csv_file is None:
          test_csv_file = data_folder + "texts/test.csv"
      else:
          test_csv_file = test_csv_file
  
      # Setting the save folder
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
  
      # Setting the ALFFA-Dataset csv files
      ALFFA_LANGUAGES = ["amharic", "fongbe", "wolof"]
      if language in ALFFA_LANGUAGES:
          df = alffa_public_prepare(language, data_folder)
          train, dev, test = train_validate_test_split(df)
          train.to_csv(
              f"{data_folder}/train.csv", index=False, sep="\t"
          )
          dev.to_csv(f"{data_folder}/dev.csv", index=False, sep="\t")
          test.to_csv(f"{data_folder}/test.csv", index=False, sep="\t")
  
      if language == "swahili":
          df = swahili_prepare(data_folder)
          train, dev, test = train_validate_test_split(df)
          train.to_csv(
              f"{data_folder}/train.csv", index=False, sep="\t"
          )
          dev.to_csv(f"{data_folder}/dev.csv", index=False, sep="\t")
          test.to_csv(f"{data_folder}/test.csv", index=False, sep="\t")
  
      if language == "multilingual":
          ALFFA_LANGUAGES = ["amharic", "wolof"]
          df_alffa = pd.DataFrame()
          for lang in ALFFA_LANGUAGES:
              data_folder2 = (
                  data_folder + f"/ALFFA_PUBLIC/ASR/{lang.upper()}/data"
              )
              df_l = alffa_public_prepare(lang, data_folder2)
              df_l["wav"] = df_l["wav"].map(
                  lambda x: f"ALFFA_PUBLIC/ASR/{lang.upper()}/data/"
                  + x.replace(f"{data_folder}/", "")
              )
              df_alffa = pd.concat([df_alffa, df_l], ignore_index=True)
          df_sw = swahili_prepare(data_folder)
  
          train_darija = pd.read_csv(
              f"{data_folder}/DVOICE/darija/texts/train.csv", sep="\t"
          )
          dev_darija = pd.read_csv(
              f"{data_folder}/DVOICE/darija/texts/dev.csv", sep="\t"
          )
          test_darija = pd.read_csv(
              f"{data_folder}/DVOICE/darija/texts/test.csv", sep="\t"
          )
          df_dar = pd.concat(
              [train_darija, dev_darija, test_darija], ignore_index=True
          )
          df_dar["wav"] = df_dar["wav"].map(
              lambda x: "DVOICE/darija/wavs/" + x
          )
          df = pd.concat([df_alffa, df_sw, df_dar], ignore_index=True)
          train, dev, test = train_validate_test_split(df)
          train.to_csv(
              f"{data_folder}/train.csv", index=False, sep="\t"
          )
          dev.to_csv(f"{data_folder}/dev.csv", index=False, sep="\t")
          test.to_csv(f"{data_folder}/test.csv", index=False, sep="\t")
  
      # Setting ouput files
      save_csv_train = save_folder + "/train.csv"
      save_csv_dev = save_folder + "/dev.csv"
      save_csv_test = save_folder + "/test.csv"
  
      # If csv already exists, we skip the data preparation
      if skip(save_csv_train, save_csv_dev, save_csv_test):
          msg = "%s already exists, skipping data preparation!" % (
              save_csv_train
          )
          logger.info(msg)
  
          msg = "%s already exists, skipping data preparation!" % (
              save_csv_dev
          )
          logger.info(msg)
  
          msg = "%s already exists, skipping data preparation!" % (
              save_csv_test
          )
          logger.info(msg)
  
          return
  
      # Additional checks to make sure the folder contains the data
      check_dvoice_folders(data_folder, language)
  
      # Creating csv file for training data
      if train_csv_file is not None:
          create_csv(
              train_csv_file,
              save_csv_train,
              data_folder,
              accented_letters,
              language,
          )
  
      # Creating csv file for dev data
      if dev_csv_file is not None:
          create_csv(
              dev_csv_file,
              save_csv_dev,
              data_folder,
              accented_letters,
              language,
          )
  
      # Creating csv file for test data
      if test_csv_file is not None:
          create_csv(
              test_csv_file,
              save_csv_test,
              data_folder,
              accented_letters,
              language,
          )
  
imports: import os
  import csv
  import re
  import logging
  import torchaudio
  import unicodedata
  from tqdm.contrib import tzip
  import random
  import pandas
  from tqdm import tqdm
  import numpy
  import glob
  from speechbrain.dataio.dataio import read_audio_info
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_dvoice(data_folder, save_folder, train_csv_file, dev_csv_file, test_csv_file, accented_letters, language, skip_prep) without return types