def GetFileObjectByPathSpec(self, path_spec):
    """Retrieves a file-like object for a path specification.

    Args:
      path_spec (PathSpec): a path specification.

    Returns:
      FileIO: a file-like object or None if not available.
    """
    file_entry = self.GetFileEntryByPathSpec(path_spec)
    if not file_entry:
      return None

    return file_entry.GetFileObject()