code: def __query_assertion(self, xpath_expr):
          
  
          assertion_expr = '/saml:Assertion'
          signature_expr = '/ds:Signature/ds:SignedInfo/ds:Reference'
          signed_assertion_query = '/samlp:Response' + assertion_expr + signature_expr
          assertion_reference_nodes = self.__query(signed_assertion_query)
          tagid = None
  
          if not assertion_reference_nodes:
              # Check if the message is signed
              signed_message_query = '/samlp:Response' + signature_expr
              message_reference_nodes = self.__query(signed_message_query)
              if message_reference_nodes:
                  message_id = message_reference_nodes[0].get('URI')
                  final_query = "/samlp:Response[@ID=$tagid]/"
                  tagid = message_id[1:]
              else:
                  final_query = "/samlp:Response"
              final_query += assertion_expr
          else:
              assertion_id = assertion_reference_nodes[0].get('URI')
              final_query = '/samlp:Response' + assertion_expr + "[@ID=$tagid]"
              tagid = assertion_id[1:]
          final_query += xpath_expr
          return self.__query(final_query, tagid)
docs: Extracts nodes that match the query from the Assertion
  
          :param xpath_expr: Xpath Expresion
          :type xpath_expr: String
  
          :returns: The queried nodes
          :rtype: list