# Example of a prompt for complex code generation prompt = """ Generate a Python class for a distributed rate limiter using a Redis backend. The class should implement the following methods: - __init__(self, redis_client, key_prefix, default_rate, default_interval): - Initializes the limiter with a Redis client, a prefix for keys, and a default rate (requests per interval). - acquire(self, identifier, rate=None, interval=None): - Attempts to acquire a permit for the given `identifier`. - Uses `rate` and `interval` if provided, otherwise uses defaults. - Returns True if acquired, False otherwise. - This should use the sliding window log algorithm with Lua scripting for atomicity. - Ensure the script handles Redis connection errors gracefully. - is_allowed(self, identifier, rate=None, interval=None): - Checks if an acquisition would be allowed without actually acquiring. - Uses `rate` and `interval` if provided, otherwise uses defaults. - Returns True if allowed, False otherwise. Provide clear docstrings for each method and the class. Include basic error handling for Redis operations. """