code: def GetNTFSFileEntryByPathSpec(self, path_spec):
      
      # Opening a file by MFT entry is faster than opening a file by location.
      # However we need the index of the corresponding $FILE_NAME MFT attribute.
      location = getattr(path_spec, 'location', None)
      mft_attribute = getattr(path_spec, 'mft_attribute', None)
      mft_entry = getattr(path_spec, 'mft_entry', None)
  
      if mft_attribute is not None and mft_entry is not None:
        fsntfs_file_entry = self._fsntfs_volume.get_file_entry(mft_entry)
      elif location is not None:
        fsntfs_file_entry = self._fsntfs_volume.get_file_entry_by_path(location)
      else:
        raise errors.PathSpecError(
            'Path specification missing location and MFT entry.')
  
      return fsntfs_file_entry
docs: Retrieves the NTFS file entry for a path specification.
  
      Args:
        path_spec (PathSpec): a path specification.
  
      Returns:
        pyfsntfs.file_entry: NTFS file entry.
  
      Raises:
        PathSpecError: if the path specification is missing location and
            MFT entry.