code: def get_config_value(request, key, default, search_in_settings=True):
      
      value = request.session.get(key, request.COOKIES.get(key))
  
      if value is None:
          if search_in_settings:
              value = getattr(settings, key, default)
          else:
              value = default
  
      if isinstance(default, int):
          try:
              value = int(value)
          except ValueError:
              value = request.session[key] = int(default)
  
      return value
docs: Retrieves the value of `key` from configuration in the following order:
  
      - from the session; if not found there then
      - from cookies; if not found there then
      - from the settings file if `search_in_settings` is True,
        otherwise this step is skipped; if not found there
      - `default` is returned