docs: def rename_keys_in_dict(d: Dict[str, Any], renames: Dict[str, str]) -> None:
      """
      Renames, IN PLACE, the keys in ``d`` according to the mapping in
      ``renames``.
      
      Args:
          d: a dictionary to modify 
          renames: a dictionary of the format ``{old_key_name: new_key_name}``
          
      See
      https://stackoverflow.com/questions/4406501/change-the-name-of-a-key-in-dictionary.
      """  # noqa
      for old_key, new_key in renames.items():
          if new_key == old_key:
              continue
          if old_key in d:
              if new_key in d:
                  raise ValueError(
                      "rename_keys_in_dict: renaming {} -> {} but new key "
                      "already exists".format(repr(old_key), repr(new_key)))
              d[new_key] = d.pop(old_key)