Design a rate limiter for an API that allows a maximum of max_requests requests within a time window of time_window seconds for each user. If a user exceeds the allowed requests, the API should deny the requests until the time window resets.
max_requests: an integer representing the maximum number of requests allowed in the time window.time_window: an integer representing the duration of the time window in seconds.user_id: a string representing the unique identifier for the user making the requests.timestamp: an integer representing the current time in seconds since the epoch.True if the request is allowed, False otherwise.Example 1:
rate_limiter(5, 10, 'user1', 1) # Output: True
rate_limiter(5, 10, 'user1', 2) # Output: True
rate_limiter(5, 10, 'user1', 3) # Output: True
rate_limiter(5, 10, 'user1', 11) # Output: True
rate_limiter(5, 10, 'user1', 12) # Output: True
rate_limiter(5, 10, 'user1', 13) # Output: False
1 <= max_requests <= 1001 <= time_window <= 1001 <= timestamp <= 10^9