Explain how you would implement rate limiting in an API.
Implement a function that processes requests in chronological order and decides whether each request is allowed. Use a per-client sliding window: a request is allowed when fewer than limit previously accepted requests from that client occurred within the preceding window seconds.
Return one Boolean per request. The input contains (client_id, timestamp) pairs, timestamps are nondecreasing integers, and only accepted requests count toward the limit.
def rate_limit(requests, limit, window):