code: def mailabs(root_path, meta_files=None, ignored_speakers=None):
      """Normalizes M-AI-Labs meta data files to TTS format
  
      Args:
          root_path (str): root folder of the MAILAB language folder.
          meta_files (str):  list of meta files to be used in the training. If None, finds all the csv files
              recursively. Defaults to None
      """
      speaker_regex = re.compile(
          f"by_book{os.sep}(male|female){os.sep}(?P<speaker_name>[^{os.sep}]+){os.sep}"
      )
      if not meta_files:
          csv_files = glob(
              root_path + f"{os.sep}**{os.sep}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:
          if os.path.isfile(csv_file):
              txt_file = csv_file
          else:
              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")
          # ignore speakers
          if isinstance(ignored_speakers, list):
              if speaker_name in ignored_speakers:
                  continue
          print(" | > {}".format(csv_file))
          with open(txt_file, "r", encoding="utf-8") as ttf:
              for line in ttf:
                  cols = line.split("|")
                  if not meta_files:
                      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": text,
                              "audio_file": wav_file,
                              "speaker_name": speaker_name,
                              "root_path": root_path,
                          }
                      )
                  else:
                      # M-AI-Labs have some missing samples, so just print the warning
                      print("> File %s does not exist!" % (wav_file))
      return items
  
imports: import os
  import re
  import xml.etree.ElementTree
  from glob import glob
  from pathlib import Path
  from typing import List
  import pandas
  from tqdm import tqdm
label_desc: Use image node_id 6 for calling a global function with example usage: mailabs(root_path, meta_files, ignored_speakers) and returns: items