code: def handle_logout_request(self, request, name_id, binding, sign=False,
                                sign_alg=None, relay_state=""):
          
          logger.info("logout request: %s", request)
  
          _req = self._parse_request(request, LogoutRequest,
                                     "single_logout_service", binding)
  
          if _req.message.name_id == name_id:
              try:
                  if self.local_logout(name_id):
                      status = success_status_factory()
                  else:
                      status = status_message_factory("Server error",
                                                      STATUS_REQUEST_DENIED)
              except KeyError:
                  status = status_message_factory("Server error",
                                                  STATUS_REQUEST_DENIED)
          else:
              status = status_message_factory("Wrong user",
                                              STATUS_UNKNOWN_PRINCIPAL)
  
          if binding == BINDING_SOAP:
              response_bindings = [BINDING_SOAP]
          elif binding == BINDING_HTTP_POST or BINDING_HTTP_REDIRECT:
              response_bindings = [BINDING_HTTP_POST, BINDING_HTTP_REDIRECT]
          else:
              response_bindings = self.config.preferred_binding[
                  "single_logout_service"]
  
          response = self.create_logout_response(_req.message, response_bindings,
                                                 status, sign, sign_alg=sign_alg)
          rinfo = self.response_args(_req.message, response_bindings)
  
          return self.apply_binding(rinfo["binding"], response,
                                    rinfo["destination"], relay_state,
                                    response=True, sign=sign)
docs: Deal with a LogoutRequest
  
          :param request: The request as text string
          :param name_id: The id of the current user
          :param binding: Which binding the message came in over
          :param sign: Whether the response will be signed or not
          :return: Keyword arguments which can be used to send the response
              what's returned follow different patterns for different bindings.
              If the binding is BINDIND_SOAP, what is returned looks like this::
  
                  {
                      "data": <the SOAP enveloped response>
                      "url": "",
                      'headers': [('content-type', 'application/soap+xml')]
                      'method': "POST
                  }