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)
 return response

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 ) return response
move the assertion to within a encrypted_assertion .