def pre_encrypt_assertion(response):
    assertion = response.assertion
    response.assertion = None
    response.encrypted_assertion = EncryptedAssertion()
    if isinstance(assertion, list):
        response.encrypted_assertion.add_extension_elements(assertion)
    else:
        response.encrypted_assertion.add_extension_element(assertion)
    # txt = "%s" % response
    # _ass = "%s" % assertion
    # _ass = rm_xmltag(_ass)
    # txt.replace(
    #     "<ns1:EncryptedAssertion/>",
    #     "<ns1:EncryptedAssertion>%s</ns1:EncryptedAssertion>" % _ass)

    return response
Move the assertion to within a encrypted_assertion
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/sigver.py/pre_encrypt_assertion