Complete public boolean isRateLimited(String requestIpAddress, String requestHttpMethod, String requestHttpPath, int requestUserId, int requestTenantId) for different cases: 1) global count, 2) path-specific request limit, 3) user + path, 4) user + path + tenant.
Asked in the coding round stage. Implement the Python equivalent as isRateLimited(requestIpAddress, requestHttpMethod, requestHttpPath, requestUserId, requestTenantId). Requests arrive sequentially, and state must persist between calls. Use limits of 10 global requests, 3 requests per path, 2 requests per user and path, and 2 requests per user, path, and tenant. Return true when the current request exceeds any applicable limit, otherwise return false. The IP address and HTTP method are accepted inputs but do not affect these four counters.
def isRateLimited(requestIpAddress, requestHttpMethod, requestHttpPath, requestUserId, requestTenantId):