docs: def rename_keys(d: Dict[str, Any], mapping: Dict[str, str]) -> Dict[str, Any]:
      """
      Returns a copy of the dictionary ``d`` with its keys renamed according to
      ``mapping``.
  
      Args:
          d: the starting dictionary
          mapping: a dictionary of the format ``{old_key_name: new_key_name}``
  
      Returns:
          a new dictionary
  
      Keys that are not in ``mapping`` are left unchanged.
      The input parameters are not modified.
      """
      result = {}  # type: Dict[str, Any]
      for k, v in d.items():
          if k in mapping:
              k = mapping[k]
          result[k] = v
      return result