<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_service_pubkeys(self, service: dict, tags: Union[Sequence[str], str]) -> List[PublicKey]: """ Add public keys specified in service. Return public keys so discovered. Raise AbsentDIDDocItem for public key reference not present in DID document. :param service: service from DID document :param tags: potential tags marking public keys of type of interest - the standard is still coalescing :return: list of public keys that service specification in DID document identifies. """


        rv = []
        for tag in [tags] if isinstance(tags, str) else list(tags):

            for svc_key in service.get(tag, {}):
                canon_key = canon_ref(self.did, svc_key)
                pubkey = None

                if '#' in svc_key:
                    if canon_key in self.pubkey:
                        pubkey = self.pubkey[canon_key]
                    else:  # service key refers to another DID doc
                        LOGGER.debug(
                            'DIDDoc.add_service_pubkeys <!< DID document %s has no public key %s',
                            self.did,
                            svc_key)
                        raise AbsentDIDDocItem('DID document {} has no public key {}'.format(self.did, svc_key))
                else:
                    for existing_pubkey in self.pubkey.values():
                        if existing_pubkey.value == svc_key:
                            pubkey = existing_pubkey
                            break
                    else:
                        pubkey = PublicKey(
                            self.did,
                            ident=svc_key[-9:-1],  # industrial-grade uniqueness
                            value=svc_key)
                        self._pubkey[pubkey.id] = pubkey

                if pubkey and pubkey not in rv:  # perverse case: could specify same key multiple ways; append once
                    rv.append(pubkey)

        return rv