<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def AddFileEntry( self, path, file_entry_type=definitions.FILE_ENTRY_TYPE_FILE, file_data=None, link_data=None):
 """Adds a fake file entry. Args: path (str):
 path of the file entry. file_entry_type (Optional[str]):
 type of the file entry object. file_data (Optional[bytes]):
 data of the fake file-like object. link_data (Optional[bytes]):
 link data of the fake file entry object. Raises: KeyError: if the path already exists. ValueError: if the file data is set but the file entry type is not a file or if the link data is set but the file entry type is not a link. """

    if path in self._paths:
      raise KeyError('File entry already set for path: {0:s}.'.format(path))

    if file_data and file_entry_type != definitions.FILE_ENTRY_TYPE_FILE:
      raise ValueError('File data set for non-file file entry type.')

    if link_data and file_entry_type != definitions.FILE_ENTRY_TYPE_LINK:
      raise ValueError('Link data set for non-link file entry type.')

    if file_data is not None:
      path_data = file_data
    elif link_data is not None:
      path_data = link_data
    else:
      path_data = None

    self._paths[path] = (file_entry_type, path_data)