def prune_creds_json(creds: dict, cred_ids: set) -> str:
rv = deepcopy(creds)<EOL>for key in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>for attr_uuid, creds_by_uuid in rv[key].items():<EOL><INDENT>rv[key][attr_uuid] = [cred for cred in creds_by_uuid if cred['<STR_LIT>']['<STR_LIT>'] in cred_ids]<EOL><DEDENT>empties = [attr_uuid for attr_uuid in rv[key] if not rv[key][attr_uuid]]<EOL>for attr_uuid in empties:<EOL><INDENT>del rv[key][attr_uuid]<EOL><DEDENT><DEDENT>return json.dumps(rv)<EOL>
Strip all creds out of the input json structure that do not match any of the input credential identifiers.

:param creds: creds structure returned by (HolderProver agent) get_creds()
:param cred_ids: the set of credential identifiers of interest
:return: the reduced creds json