<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group_manifests_and_tag(self, session, worker_digests):
 """ Creates a manifest list or OCI image index that groups the different manifests in worker_digests, then tags the result with with all the configured tags found in workflow.tag_conf. """

        self.log.info("%s: Creating manifest list", session.registry)

        # Extract information about the manifests that we will group - we get the
        # size and content type of the manifest by querying the registry
        manifests = []
        for platform, worker_image in worker_digests.items():
            repository = worker_image['repository']
            digest = worker_image['digest']
            media_type = get_manifest_media_type(worker_image['version'])
            if media_type not in self.manifest_media_types:
                continue
            content, _, media_type, size = self.get_manifest(session, repository, digest)

            manifests.append({
                'content': content,
                'repository': repository,
                'digest': digest,
                'size': size,
                'media_type': media_type,
                'architecture': self.goarch.get(platform, platform),
            })

        list_type, list_json = self.build_list(manifests)
        self.log.info("%s: Created manifest, Content-Type=%s\n%s", session.registry,
                      list_type, list_json)

        # Now push the manifest list to the registry once per each tag
        self.log.info("%s: Tagging manifest list", session.registry)

        for image in self.workflow.tag_conf.images:
            target_repo = image.to_str(registry=False, tag=False)
            # We have to call store_manifest_in_repository directly for each
            # referenced manifest, since they potentially come from different repos
            for manifest in manifests:
                self.store_manifest_in_repository(session,
                                                  manifest['content'],
                                                  manifest['media_type'],
                                                  manifest['repository'],
                                                  target_repo,
                                                  digest=manifest['digest'])
            self.store_manifest_in_repository(session, list_json, list_type,
                                              target_repo, target_repo, tag=image.tag)
        # Get the digest of the manifest list using one of the tags
        registry_image = self.workflow.tag_conf.unique_images[0]
        _, digest_str, _, _ = self.get_manifest(session,
                                                registry_image.to_str(registry=False, tag=False),
                                                registry_image.tag)

        if list_type == MEDIA_TYPE_OCI_V1_INDEX:
            digest = ManifestDigest(oci_index=digest_str)
        else:
            digest = ManifestDigest(v2_list=digest_str)

        # And store the manifest list in the push_conf
        push_conf_registry = self.workflow.push_conf.add_docker_registry(session.registry,
                                                                         insecure=session.insecure)
        for image in self.workflow.tag_conf.images:
            push_conf_registry.digests[image.tag] = digest

        self.log.info("%s: Manifest list digest is %s", session.registry, digest_str)
        return registry_image.get_repo(explicit_namespace=False), digest