code: def GetZipInfoByPathSpec(self, path_spec):
      
      location = getattr(path_spec, 'location', None)
      if location is None:
        raise errors.PathSpecError('Path specification missing location.')
  
      if not location.startswith(self.LOCATION_ROOT):
        raise errors.PathSpecError('Invalid location in path specification.')
  
      if len(location) > 1:
        return self._zip_file.getinfo(location[1:])
  
      return None
docs: Retrieves the ZIP info for a path specification.
  
      Args:
        path_spec (PathSpec): a path specification.
  
      Returns:
        zipfile.ZipInfo: a ZIP info object or None if not available.
  
      Raises:
        PathSpecError: if the path specification is incorrect.