docs: def logout(request, config_loader_path=None):
      """SAML Logout Request initiator
  
      This view initiates the SAML2 Logout request
      using the pysaml2 library to create the LogoutRequest.
      """
      state = StateCache(request.session)
      conf = get_config(config_loader_path, request)
  
      client = Saml2Client(conf, state_cache=state,
                           identity_cache=IdentityCache(request.session))
      subject_id = _get_subject_id(request.session)
      if subject_id is None:
          logger.warning(
              'The session does not contain the subject id for user %s',
              request.user)
  
      result = client.global_logout(subject_id)
  
      state.sync()
  
      if not result:
          logger.error("Looks like the user %s is not logged in any IdP/AA", subject_id)
          return HttpResponseBadRequest("You are not logged in any IdP/AA")
  
      if len(result) > 1:
          logger.error('Sorry, I do not know how to logout from several sources. I will logout just from the first one')
  
      for entityid, logout_info in result.items():
          if isinstance(logout_info, tuple):
              binding, http_info = logout_info
              if binding == BINDING_HTTP_POST:
                  logger.debug('Returning form to the IdP to continue the logout process')
                  body = ''.join(http_info['data'])
                  return HttpResponse(body)
              elif binding == BINDING_HTTP_REDIRECT:
                  logger.debug('Redirecting to the IdP to continue the logout process')
                  return HttpResponseRedirect(get_location(http_info))
              else:
                  logger.error('Unknown binding: %s', binding)
                  return HttpResponseServerError('Failed to log out')
          else:
              # We must have had a soap logout
              return finish_logout(request, logout_info)
  
      logger.error('Could not logout because there only the HTTP_REDIRECT is supported')
      return HttpResponseServerError('Logout Binding not supported')