def AddMapping(self, filename, new_mapping):
    """Adds an entry to the list of known filenames.

    Args:
        filename: The filename whose mapping is being added.
        new_mapping: A dictionary with the mapping to add. Must contain all
            fields in _REQUIRED_MAPPING_FIELDS.
    Raises:
        DuplicateMapping if the filename already exists in the mapping
        InvalidMapping if not all required fields are present
    """
    for field in self._REQUIRED_MAPPING_FIELDS:
      if field not in new_mapping:
        raise problems.InvalidMapping(field)
    if filename in self.GetKnownFilenames():
      raise problems.DuplicateMapping(filename)
    self._file_mapping[filename] = new_mapping
Adds an entry to the list of known filenames.

    Args:
        filename: The filename whose mapping is being added.
        new_mapping: A dictionary with the mapping to add. Must contain all
            fields in _REQUIRED_MAPPING_FIELDS.
    Raises:
        DuplicateMapping if the filename already exists in the mapping
        InvalidMapping if not all required fields are present