def MapPath(path, path_mappings):
  """Maps path into a new path through path_mappings.

  Note that the order in path_mappings matters, different order might end up
  different result.
  """
  if not path or not path_mappings:
    return path

  for path_mapping in path_mappings:
    path = path_mapping(path)

  return path