code: func fetchManifest(ctx context.Context, repo distribution.Repository, ref reference.Named) (types.ImageManifest, error) {
  	manifest, err := getManifest(ctx, repo, ref)
  	if err != nil {
  		return types.ImageManifest{}, err
  	}
  
  	switch v := manifest.(type) {
  	// Removed Schema 1 support
  	case *schema2.DeserializedManifest:
  		imageManifest, err := pullManifestSchemaV2(ctx, ref, repo, *v)
  		if err != nil {
  			return types.ImageManifest{}, err
  		}
  		return imageManifest, nil
  	case *manifestlist.DeserializedManifestList:
  		return types.ImageManifest{}, errors.Errorf("%s is a manifest list", ref)
  	}
  	return types.ImageManifest{}, errors.Errorf("%s is not a manifest", ref)
  }
docs: // fetchManifest pulls a manifest from a registry and returns it. An error
  // is returned if no manifest is found matching namedRef.