def parse_assertion(self, key_file=""):
        if self.context == "AuthnQuery":
            # can contain one or more assertions
            pass
        else:  # This is a saml2int limitation
            try:
                assert len(self.response.assertion) == 1 or \
                    len(self.response.encrypted_assertion) == 1
            except __HOLE__:
                raise Exception("No assertion part")

        res = []
        if self.response.encrypted_assertion:
            logger.debug("***Encrypted assertion/-s***")
            decr_text = self.sec.decrypt(self.xmlstr, key_file)
            resp = samlp.response_from_string(decr_text)
            res = self.decrypt_assertions(resp.encrypted_assertion, decr_text)
            if self.response.assertion:
                self.response.assertion.extend(res)
            else:
                self.response.assertion = res
            self.response.encrypted_assertion = []
            self.xmlstr = decr_text

        if self.response.assertion:
            logger.debug("***Unencrypted assertion***")
            for assertion in self.response.assertion:
                if not self._assertion(assertion, assertion in res):
                    return False
                else:
                    self.assertions.append(assertion)
            self.assertion = self.assertions[0]

        return True
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/response.py/AuthnResponse.parse_assertion