code: def get_race_ethnicity_name_list_given_tzioumis_data(
      percent_df: pd.DataFrame,
      race_gender_name_lists: Dict[str, List[str]],
      race_ethnicity: str,
  ) -> List[str]:
      """
      Given input Tzioumis data (percent_df) and a set of names split by gender and
      race/ethnicity from Milkman et al.
  
      (2012), Caliskan et al. (2017), and Guo and Caliskan (2020)., get a list of names
      for the given race/ethnicity.
      """
  
      # Params
      tzioumis_to_race_gender_mapping = {
          "hispanic": "his",
          "white": "ea",
          "black": "aa",
      }
      num_names_per_race_ethnicity = 200
      # Number of names to select per race/ethnicity, to keep the lists tractable
  
      # Determine which names are most commonly of the specified race/ethnicity (i.e.
      # plurality), and pick those that have the most observations for that
      # ethnicity
      this_ethnicity_column = f"pct{race_ethnicity}"
      percent_columns = [
          f"pct{race_eth}" for race_eth in RACES_ETHNICITIES
      ]
      max_percent_series = percent_df[percent_columns].max(axis=1)
      percent_plurality_names_df = (
          percent_df[
              lambda df: df[this_ethnicity_column] == max_percent_series
          ]
          .assign(
              obs_of_this_ethnicity=lambda df: df["obs"]
              * df[this_ethnicity_column]
              / 100
          )
          .sort_values("obs_of_this_ethnicity", ascending=False)
      )
      tzioumis_plurality_names = percent_plurality_names_df.iloc[
          :num_names_per_race_ethnicity
      ].index.values.tolist()
  
      # Combine these names with the Caliskan+ race+gender names and deduplicate
      if race_ethnicity in tzioumis_to_race_gender_mapping:
          mapped_ethnicity = tzioumis_to_race_gender_mapping[
              race_ethnicity
          ]
          female_race_gender_name_list = race_gender_name_lists[
              f"{mapped_ethnicity}_female"
          ]
          if mapped_ethnicity == "aa":
              # Avoid the same name in two lists by removing it from this one
              female_race_gender_name_list.remove("Yolanda")
          elif mapped_ethnicity == "his":
              # Avoid the same name in two lists by removing it from this one
              female_race_gender_name_list.remove("Brenda")
          # TODO: add a programmatic way to detect duplicates, to generalize for updated
          #  versions of the source datasets
          male_race_gender_name_list = race_gender_name_lists[
              f"{mapped_ethnicity}_male"
          ]
          combined_names = (
              tzioumis_plurality_names
              + female_race_gender_name_list
              + male_race_gender_name_list
          )
      else:
          combined_names = tzioumis_plurality_names
  
      # Deduplicate and sort
      sorted_names = sorted(list(set(combined_names)))
  
      print(
          f"Using {len(sorted_names):d} names for the {race_ethnicity} race/ethnicity: "
          + ", ".join(sorted_names)
      )
  
      return sorted_names
  
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 6 for calling a global function with example usage: get_race_ethnicity_name_list_given_tzioumis_data(percent_df, race_gender_name_lists, race_ethnicity) and returns: sorted_names