code: def get_race_ethnicity_gender_name_list(
      baby_name_folder: str,
      tzioumis_data_path: str,
      race_gender_name_lists: Dict[str, List[str]],
  ) -> Tuple[Dict[str, str], Dict[str, List[str]]]:
      """
      Get name lists split by both race/ethnicity and by gender, given input name lists
      (see inner functions for the sources of these lists).
      """
  
      baby_name_counts_by_gender = get_baby_name_counts_by_gender(
          baby_name_folder
      )
  
      # Split original name lists by gender
      orig_name_lists = get_tzioumis_name_lists(
          tzioumis_data_path=tzioumis_data_path,
          race_gender_name_lists=race_gender_name_lists,
      )
      print("\nSplitting original name lists by gender.")
      names_to_new_lists = {}
      for name_list, names in orig_name_lists.items():
          for name in names:
              proc_name = name.replace("-", "")
              proc_name = proc_name[0].upper() + proc_name[1:].lower()
              # Removing hyphens and changing capitalization to match the formatting of
              # the baby-name lists
              if (
                  baby_name_counts_by_gender[proc_name]["F"]
                  > baby_name_counts_by_gender[proc_name]["M"]
              ):
                  names_to_new_lists[name] = f"{name_list}_female"
              elif (
                  baby_name_counts_by_gender[proc_name]["M"]
                  > baby_name_counts_by_gender[proc_name]["F"]
              ):
                  names_to_new_lists[name] = f"{name_list}_male"
              else:
                  # Tie
                  names_to_new_lists[name] = f"{name_list}_unknown"
      assert len(names_to_new_lists) == sum(
          [len(names) for names in orig_name_lists.values()]
      )
  
      # Print the names in each of the new name lists
      new_name_lists = defaultdict(list)
      for name, name_list in names_to_new_lists.items():
          new_name_lists[name_list].append(name)
      for name_list in sorted(new_name_lists.keys()):
          sorted_names = sorted(new_name_lists[name_list])
          print(
              f"\nUsing {len(sorted_names):d} names for the {name_list} name list: "
              + ", ".join(sorted_names)
          )
  
      return names_to_new_lists, new_name_lists
  
file_path: ParlAI/projects/dialogue_bias/util.py
imports: import os
  from collections import defaultdict
  from typing import Dict, List, Tuple
  import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: get_race_ethnicity_gender_name_list(baby_name_folder, tzioumis_data_path, race_gender_name_lists) and returns: names_to_new_lists,  new_name_lists