Thales CipherTrust Manager integrations should reject malformed or unsuccessful API responses before processing returned data. Write a function that validates one decoded CipherTrust Manager API response represented as a Python dictionary.
A response is valid only when all of these rules hold:
status_code is an integer from 200 through 299.body is a dictionary.body["request_id"] is a non-empty string.body["status"] is exactly the string "ok".data key exists in body. Its value may be any JSON-compatible value, including null, a list, or an empty dictionary.Return True when every rule passes. Return False for missing keys, incorrect types, unsuccessful status codes, or invalid values. Extra response or body fields are allowed.
Input: response, a Python dictionary containing JSON-like values.
Output: A Boolean indicating whether the response satisfies the validation rules.
response contains at most 20 top-level keys.body contains at most 50 keys when it is a dictionary.def validate_api_response(response):