def is_valid(self, request_data, request_id=None, raise_exceptions=False):
self.__error = None<EOL>try:<EOL><INDENT>idp_data = self.__settings.get_idp_data()<EOL>idp_entity_id = idp_data['<STR_LIT>']<EOL>get_data = request_data['<STR_LIT>']<EOL>if self.__settings.is_strict():<EOL><INDENT>res = OneLogin_Saml2_XML.validate_xml(self.document, '<STR_LIT>', self.__settings.is_debug_active())<EOL>if isinstance(res, str):<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>',<EOL>OneLogin_Saml2_ValidationError.INVALID_XML_FORMAT<EOL>)<EOL><DEDENT>security = self.__settings.get_security_data()<EOL>in_response_to = self.document.get('<STR_LIT>', None)<EOL>if request_id is not None and in_response_to and in_response_to != request_id:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>' % (in_response_to, request_id),<EOL>OneLogin_Saml2_ValidationError.WRONG_INRESPONSETO<EOL>)<EOL><DEDENT>issuer = self.get_issuer()<EOL>if issuer is not None and issuer != idp_entity_id:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>' %<EOL>{<EOL>'<STR_LIT>': idp_entity_id,<EOL>'<STR_LIT>': issuer<EOL>},<EOL>OneLogin_Saml2_ValidationError.WRONG_ISSUER<EOL>)<EOL><DEDENT>current_url = OneLogin_Saml2_Utils.get_self_url_no_query(request_data)<EOL>destination = self.document.get('<STR_LIT>', None)<EOL>if destination and current_url not in destination:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>' % (current_url, destination),<EOL>OneLogin_Saml2_ValidationError.WRONG_DESTINATION<EOL>)<EOL><DEDENT>if security['<STR_LIT>']:<EOL><INDENT>if '<STR_LIT>' not in get_data:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>',<EOL>OneLogin_Saml2_ValidationError.NO_SIGNED_MESSAGE<EOL>)<EOL><DEDENT><DEDENT><DEDENT>return True<EOL><DEDENT>except Exception as err:<EOL><INDENT>self.__error = str(err)<EOL>debug = self.__settings.is_debug_active()<EOL>if debug:<EOL><INDENT>print(err)<EOL><DEDENT>if raise_exceptions:<EOL><INDENT>raise<EOL><DEDENT>return False<EOL><DEDENT>
Determines if the SAML LogoutResponse is valid
:param request_id: The ID of the LogoutRequest sent by this SP to the IdP
:type request_id: string

:param raise_exceptions: Whether to return false on failure or raise an exception
:type raise_exceptions: Boolean

:return: Returns if the SAML LogoutResponse is or not valid
:rtype: boolean