def METHOD_NAME(request):
    if request.authz.logged_in:
        return
    limit = SETTINGS.API_RATE_LIMIT * SETTINGS.API_RATE_WINDOW
    request.rate_limit = get_rate_limit(
        _get_remote_ip(), limit=limit, interval=SETTINGS.API_RATE_WINDOW, unit=60
    )
    if not request.rate_limit.check():
        raise TooManyRequests("Rate limit exceeded.")