code: def check_request(request, login_unsuccessful,
                    get_username=get_username_from_request,
                    username=None):
      
      ip_address = get_ip(request)
      username = username or get_username(request)
  
      if not login_unsuccessful:
          # user logged in -- forget the failed attempts
          reset_failed_attempts(ip_address=ip_address, username=username)
          return True
      else:
          # add a failed attempt for this user
          return record_failed_attempt(ip_address, username)
docs: check the request, and process results