def is_valid(self, request_data, raise_exceptions=False):
self.__error = None<EOL>try:<EOL><INDENT>root = OneLogin_Saml2_XML.to_etree(self.__logout_request)<EOL>idp_data = self.__settings.get_idp_data()<EOL>idp_entity_id = idp_data['<STR_LIT>']<EOL>get_data = ('<STR_LIT>' in request_data and request_data['<STR_LIT>']) or dict()<EOL>if self.__settings.is_strict():<EOL><INDENT>res = OneLogin_Saml2_XML.validate_xml(root, '<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>current_url = OneLogin_Saml2_Utils.get_self_url_no_query(request_data)<EOL>if root.get('<STR_LIT>', None):<EOL><INDENT>na = OneLogin_Saml2_Utils.parse_SAML_to_time(root.get('<STR_LIT>'))<EOL>if na <= OneLogin_Saml2_Utils.now():<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>',<EOL>OneLogin_Saml2_ValidationError.RESPONSE_EXPIRED<EOL>)<EOL><DEDENT><DEDENT>if root.get('<STR_LIT>', None):<EOL><INDENT>destination = root.get('<STR_LIT>')<EOL>if destination != '<STR_LIT>':<EOL><INDENT>if current_url not in destination:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>{<EOL>'<STR_LIT>': current_url,<EOL>'<STR_LIT>': destination,<EOL>},<EOL>OneLogin_Saml2_ValidationError.WRONG_DESTINATION<EOL>)<EOL><DEDENT><DEDENT><DEDENT>issuer = OneLogin_Saml2_Logout_Request.get_issuer(root)<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>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>
Checks if the Logout Request received is valid
:param request_data: Request Data
:type request_data: dict

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

:return: If the Logout Request is or not valid
:rtype: boolean