code: def key_prefix_replace(d, prefix, new_prefix=""):
      
      items = []
      for k, v in d.items():
          new_key = k
          for p in prefix:
              new_key = new_key.replace(p, new_prefix, 1)
          items.append((new_key, v))
      return dict(items)
docs: replaces the list of prefix in keys of a flattened dict
  
      :param d: the flattened dict
      :param prefix: a list of prefixes that are replaced with a new prefix.
                     Typically this will be ""
      :type prefix: list of str
      :param new_prefix: The new prefix. By default it is set to ""
      :return: the dict with the keys replaced as specified