code: def process_request(self, request):
          
  
          LOGGER.debug('termsandconditions.middleware')
  
          current_path = request.META['PATH_INFO']
  
          if DJANGO_VERSION <= (2, 0, 0):
              user_authenticated = request.user.is_authenticated()
          else:
              user_authenticated = request.user.is_authenticated
  
          if user_authenticated and is_path_protected(current_path):
              for term in TermsAndConditions.get_active_terms_not_agreed_to(request.user):
                  # Check for querystring and include it if there is one
                  qs = request.META['QUERY_STRING']
                  current_path += '?' + qs if qs else ''
                  return redirect_to_terms_accept(current_path, term.slug)
  
          return None
docs: Process each request to app to ensure terms have been accepted