code: def write_csvs(extracted):
      sample_counter = 0
      reasons = Counter()
      for sub_set in ["train", "dev", "test"]:
          set_path = os.path.join(extracted, sub_set)
          set_files = os.listdir(set_path)
          recordings = {}
          for file in set_files:
              if file.endswith(".xml"):
                  recordings[file[:-4]] = []
          for file in set_files:
              if file.endswith(".wav") and "_" in file:
                  prefix = file.split("_")[0]
                  if prefix in recordings:
                      recordings[prefix].append(file)
          recordings = recordings.items()
          csv_path = os.path.join(
              CLI_ARGS.base_dir,
              "tuda-{}-{}.csv".format(TUDA_VERSION, sub_set),
          )
          print('Writing "{}"...'.format(csv_path))
          with open(
              csv_path, "w", encoding="utf-8", newline=""
          ) as csv_file:
              writer = csv.DictWriter(csv_file, fieldnames=FIELDNAMES)
              writer.writeheader()
              set_dir = os.path.join(extracted, sub_set)
              bar = progressbar.ProgressBar(
                  max_value=len(recordings), widgets=SIMPLE_BAR
              )
              for prefix, wav_names in bar(recordings):
                  xml_path = os.path.join(set_dir, prefix + ".xml")
                  meta = ET.parse(xml_path).getroot()
                  sentence = list(meta.iter("cleaned_sentence"))[0].text
                  sentence = check_and_prepare_sentence(sentence)
                  if sentence is None:
                      reasons["alphabet filter"] += 1
                      continue
                  for wav_name in wav_names:
                      sample_counter += 1
                      wav_path = os.path.join(set_path, wav_name)
                      keep, reason = check_wav_file(wav_path, sentence)
                      if keep:
                          writer.writerow(
                              {
                                  "wav_filename": os.path.relpath(
                                      wav_path, CLI_ARGS.base_dir
                                  ),
                                  "wav_filesize": os.path.getsize(
                                      wav_path
                                  ),
                                  "transcript": sentence.lower(),
                              }
                          )
                      else:
                          reasons[reason] += 1
      if len(reasons.keys()) > 0:
          print("Excluded samples:")
          for reason, n in reasons.most_common():
              print(
                  ' - "{}": {} ({:.2f}%)'.format(
                      reason, n, n * 100 / sample_counter
                  )
              )
  
file_path: DeepSpeech/bin/import_tuda.py
imports: import argparse
  import csv
  import os
  import tarfile
  import unicodedata
  import wave
  import xml.etree.ElementTree
  from collections import Counter
  import progressbar
  from deepspeech_training.util.downloader import SIMPLE_BAR, maybe_download
  from deepspeech_training.util.importers import validate_label_eng
  from ds_ctcdecoder import Alphabet
label_desc: Use image node_id 5 for calling a global function with example usage: write_csvs(extracted) without return types