code: def query_registry(registry_session, image, digest=None, version='v1', is_blob=False):
      
  
      context = '/'.join([x for x in [image.namespace, image.repo] if x])
      reference = digest or image.tag
      object_type = 'manifests'
      if is_blob:
          object_type = 'blobs'
  
      headers = {'Accept': (get_manifest_media_type(version))}
      url = '/v2/{}/{}/{}'.format(context, object_type, reference)
      logger.debug("query_registry: querying {}, headers: {}".format(url, headers))
  
      response = registry_session.get(url, headers=headers)
      for r in chain(response.history, [response]):
          logger.debug("query_registry: [%s] %s", r.status_code, r.url)
  
      logger.debug("query_registry: response headers: %s", response.headers)
      response.raise_for_status()
  
      return response
docs: Return manifest digest for image.
  
      :param registry_session: RegistrySession
      :param image: ImageName, the remote image to inspect
      :param digest: str, digest of the image manifest
      :param version: str, which manifest schema version to fetch digest
      :param is_blob: bool, read blob config if set to True
  
      :return: requests.Response object