code: def _maybe_convert_set(
      dataset,
      tsv_dir,
      audio_dir,
      filter_obj,
      space_after_every_character=None,
      rows=None,
      exclude=None,
  ):
      exclude_transcripts = set()
      exclude_speakers = set()
      if exclude is not None:
          for sample in exclude:
              exclude_transcripts.add(sample[2])
              exclude_speakers.add(sample[3])
  
      if rows is None:
          rows = []
          input_tsv = os.path.join(
              os.path.abspath(tsv_dir), dataset + ".tsv"
          )
          if not os.path.isfile(input_tsv):
              return rows
          print("Loading TSV file: ", input_tsv)
          # Get audiofile path and transcript for each sentence in tsv
          samples = []
          with open(input_tsv, encoding="utf-8") as input_tsv_file:
              reader = csv.DictReader(input_tsv_file, delimiter="\t")
              for row in reader:
                  samples.append(
                      (
                          os.path.join(audio_dir, row["path"]),
                          row["sentence"],
                          row["client_id"],
                      )
                  )
  
          counter = get_counter()
          num_samples = len(samples)
  
          print("Importing mp3 files...")
          pool = Pool(initializer=init_worker, initargs=(PARAMS,))
          bar = progressbar.ProgressBar(
              max_value=num_samples, widgets=SIMPLE_BAR
          )
          for i, processed in enumerate(
              pool.imap_unordered(one_sample, samples), start=1
          ):
              counter += processed[0]
              rows += processed[1]
              bar.update(i)
          bar.update(num_samples)
          pool.close()
          pool.join()
  
          imported_samples = get_imported_samples(counter)
          assert counter["all"] == num_samples
          assert len(rows) == imported_samples
          print_import_report(counter, SAMPLE_RATE, MAX_SECS)
  
      output_csv = os.path.join(
          os.path.abspath(audio_dir), dataset + ".csv"
      )
      print("Saving new DeepSpeech-formatted CSV file to: ", output_csv)
      with open(
          output_csv, "w", encoding="utf-8", newline=""
      ) as output_csv_file:
          print("Writing CSV file for DeepSpeech.py as: ", output_csv)
          writer = csv.DictWriter(
              output_csv_file, fieldnames=FIELDNAMES
          )
          writer.writeheader()
          bar = progressbar.ProgressBar(
              max_value=len(rows), widgets=SIMPLE_BAR
          )
          for filename, file_size, transcript, speaker in bar(rows):
              if (
                  transcript in exclude_transcripts
                  or speaker in exclude_speakers
              ):
                  continue
              if space_after_every_character:
                  writer.writerow(
                      {
                          "wav_filename": filename,
                          "wav_filesize": file_size,
                          "transcript": " ".join(transcript),
                      }
                  )
              else:
                  writer.writerow(
                      {
                          "wav_filename": filename,
                          "wav_filesize": file_size,
                          "transcript": transcript,
                      }
                  )
      return rows
  
file_path: DeepSpeech/bin/import_cv2.py
imports: import csv
  import os
  import subprocess
  import unicodedata
  from multiprocessing import Pool
  import progressbar
  import sox
  from deepspeech_training.util.downloader import SIMPLE_BAR
  from deepspeech_training.util.importers import get_counter, get_imported_samples, get_importers_parser, get_validate_label, print_import_report
  from ds_ctcdecoder import Alphabet
label_desc: Use image node_id 3 for calling a global function with example usage: _maybe_convert_set(dataset, tsv_dir, audio_dir, filter_obj, space_after_every_character, rows, exclude) and returns: rows, rows