code: def mailabs(root_path, meta_files=None):
      """Normalizes M-AI-Labs meta data files to TTS format"""
      speaker_regex = re.compile(
          "by_book/(male|female)/(?P<speaker_name>[^/]+)/"
      )
      if meta_files is None:
          csv_files = glob(
              root_path + "/**/metadata.csv", recursive=True
          )
      else:
          csv_files = meta_files
      # meta_files = [f.strip() for f in meta_files.split(",")]
      items = []
      for csv_file in csv_files:
          txt_file = os.path.join(root_path, csv_file)
          folder = os.path.dirname(txt_file)
          # determine speaker based on folder structure...
          speaker_name_match = speaker_regex.search(txt_file)
          if speaker_name_match is None:
              continue
          speaker_name = speaker_name_match.group("speaker_name")
          print(" | > {}".format(csv_file))
          with open(txt_file, "r") as ttf:
              for line in ttf:
                  cols = line.split("|")
                  if meta_files is None:
                      wav_file = os.path.join(
                          folder, "wavs", cols[0] + ".wav"
                      )
                  else:
                      wav_file = os.path.join(
                          root_path,
                          folder.replace("metadata.csv", ""),
                          "wavs",
                          cols[0] + ".wav",
                      )
                  if os.path.isfile(wav_file):
                      text = cols[1].strip()
                      items.append([text, wav_file, speaker_name])
                  else:
                      raise RuntimeError(
                          "> File %s does not exist!" % (wav_file)
                      )
      return items
  
imports: import os
  from glob import glob
  import re
  import sys
  from pathlib import Path
  from tqdm import tqdm
  from TTS.tts.utils.generic_utils import split_dataset
label_desc: Use image node_id 7 for calling a global function with example usage: mailabs(root_path, meta_files) and returns: items