code: def get_config_and_id_from_registry(image, registry, digest, insecure=False,
                                      dockercfg_path=None, version='v2'):
      
      registry_session = RegistrySession(registry, insecure=insecure, dockercfg_path=dockercfg_path)
  
      response = query_registry(
          registry_session, image, digest=digest, version=version)
      response.raise_for_status()
      manifest_config = response.json()
      config_digest = manifest_config['config']['digest']
  
      config_response = query_registry(
          registry_session, image, digest=config_digest, version=version, is_blob=True)
      config_response.raise_for_status()
  
      blob_config = config_response.json()
  
      context = '/'.join([x for x in [image.namespace, image.repo] if x])
      tag = image.tag
      logger.debug('Image %s:%s has config:\n%s', context, tag, blob_config)
  
      return blob_config, config_digest
docs: Return image config by digest
  
      :param image: ImageName, the remote image to inspect
      :param registry: str, URI for registry, if URI schema is not provided,
                            https:// will be used
      :param digest: str, digest of the image manifest
      :param insecure: bool, when True registry's cert is not verified
      :param dockercfg_path: str, dirname of .dockercfg location
      :param version: str, which manifest schema versions to fetch digest
  
      :return: dict, versions mapped to their digest