def __init__(self, settings, request=None, name_id=None, session_index=None, nq=None, name_id_format=None):
self.__settings = settings<EOL>self.__error = None<EOL>self.id = None<EOL>if request is None:<EOL><INDENT>sp_data = self.__settings.get_sp_data()<EOL>idp_data = self.__settings.get_idp_data()<EOL>security = self.__settings.get_security_data()<EOL>uid = OneLogin_Saml2_Utils.generate_unique_id()<EOL>self.id = uid<EOL>issue_instant = OneLogin_Saml2_Utils.parse_time_to_SAML(OneLogin_Saml2_Utils.now())<EOL>cert = None<EOL>if security['<STR_LIT>']:<EOL><INDENT>exists_multix509enc = '<STR_LIT>' in idp_data and'<STR_LIT>' in idp_data['<STR_LIT>'] andidp_data['<STR_LIT>']['<STR_LIT>']<EOL>if exists_multix509enc:<EOL><INDENT>cert = idp_data['<STR_LIT>']['<STR_LIT>'][<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>cert = idp_data['<STR_LIT>']<EOL><DEDENT><DEDENT>if name_id is not None:<EOL><INDENT>if not name_id_format and sp_data['<STR_LIT>'] != OneLogin_Saml2_Constants.NAMEID_UNSPECIFIED:<EOL><INDENT>name_id_format = sp_data['<STR_LIT>']<EOL><DEDENT><DEDENT>else:<EOL><INDENT>name_id_format = OneLogin_Saml2_Constants.NAMEID_ENTITY<EOL><DEDENT>sp_name_qualifier = None<EOL>if name_id_format == OneLogin_Saml2_Constants.NAMEID_ENTITY:<EOL><INDENT>name_id = idp_data['<STR_LIT>']<EOL>nq = None<EOL><DEDENT>elif nq is not None:<EOL><INDENT>sp_name_qualifier = sp_data['<STR_LIT>']<EOL><DEDENT>name_id_obj = OneLogin_Saml2_Utils.generate_name_id(<EOL>name_id,<EOL>sp_name_qualifier,<EOL>name_id_format,<EOL>cert,<EOL>False,<EOL>nq<EOL>)<EOL>if session_index:<EOL><INDENT>session_index_str = '<STR_LIT>' % session_index<EOL><DEDENT>else:<EOL><INDENT>session_index_str = '<STR_LIT>'<EOL><DEDENT>logout_request = OneLogin_Saml2_Templates.LOGOUT_REQUEST %{<EOL>'<STR_LIT:id>': uid,<EOL>'<STR_LIT>': issue_instant,<EOL>'<STR_LIT>': idp_data['<STR_LIT>']['<STR_LIT:url>'],<EOL>'<STR_LIT>': sp_data['<STR_LIT>'],<EOL>'<STR_LIT>': name_id_obj,<EOL>'<STR_LIT>': session_index_str,<EOL>}<EOL><DEDENT>else:<EOL><INDENT>logout_request = OneLogin_Saml2_Utils.decode_base64_and_inflate(request, ignore_zip=True)<EOL>self.id = self.get_id(logout_request)<EOL><DEDENT>self.__logout_request = compat.to_string(logout_request)<EOL>
Constructs the Logout Request object.

:param settings: Setting data
:type settings: OneLogin_Saml2_Settings

:param request: Optional. A LogoutRequest to be loaded instead build one.
:type request: string

:param name_id: The NameID that will be set in the LogoutRequest.
:type name_id: string

:param session_index: SessionIndex that identifies the session of the user.
:type session_index: string

:param nq: IDP Name Qualifier
:type: string

:param name_id_format: The NameID Format that will be set in the LogoutRequest.
:type: string