def write_metadata_by_name(self, name, metadata_key, metadata_value):
    """Write process metadata using a named identity.

    :param string name: The ProcessMetadataManager identity/name (e.g. 'pantsd').
    :param string metadata_key: The metadata key (e.g. 'pid').
    :param string metadata_value: The metadata value (e.g. '1729').
    """
    self._maybe_init_metadata_dir_by_name(name)
    file_path = self._metadata_file_path(name, metadata_key)
    safe_file_dump(file_path, metadata_value)