code: def _rename_coords(ds, attrs):
      
      for name_int, names_ext in attrs.items():
          # Check if coord is in dataset already.
          ds_coord_name = set(names_ext).intersection(set(ds.coords))
          if ds_coord_name:
              # Rename to the aospy internal name.
              try:
                  ds = ds.rename({list(ds_coord_name)[0]: name_int})
                  logging.debug("Rename coord from `{0}` to `{1}` for "
                                "Dataset `{2}`".format(ds_coord_name,
                                                       name_int, ds))
              # xarray throws a ValueError if the name already exists
              except ValueError:
                  ds = ds
      return ds
docs: Rename coordinates to aospy's internal names.