code: def GetTSKFileByPathSpec(self, path_spec):
      
      # Opening a file by inode number is faster than opening a file
      # by location.
      inode = getattr(path_spec, 'inode', None)
      location = getattr(path_spec, 'location', None)
  
      if inode is not None:
        tsk_file = self._tsk_file_system.open_meta(inode=inode)
      elif location is not None:
        tsk_file = self._tsk_file_system.open(location)
      else:
        raise errors.PathSpecError(
            'Path specification missing inode and location.')
  
      return tsk_file
docs: Retrieves the SleuthKit file object for a path specification.
  
      Args:
        path_spec (PathSpec): path specification.
  
      Returns:
        pytsk3.File: TSK file.
  
      Raises:
        PathSpecError: if the path specification is missing inode and location.