code: def get_gendered_words_mapping(
      mapping: Union[str, Dict[str, str]]
  ) -> Dict[str, str]:
      """
      Note: The `swap_gendered_words` augmentation, including this logic, was originally
      written by Adina Williams and has been used in influential work, e.g.
      https://arxiv.org/pdf/2005.00614.pdf
      """
      assert isinstance(
          mapping, (str, Dict)
      ), "Mapping must be either a dict or filepath to a mapping of gendered words"
  
      if isinstance(mapping, Dict):
          return mapping
  
      if isinstance(mapping, str):
          with utils.pathmgr.open(mapping) as f:
              return json.load(f)
  
file_path: AugLy/augly/text/utils.py
imports: import json
  from copy import deepcopy
  from typing import Any, Dict, List, Optional, Union
  from augly import utils
  from augly.text import intensity
label_desc: Use image node_id 3 for calling a global function with example usage: get_gendered_words_mapping(mapping) and returns: mapping, json