Implement a CgiServiceConfig object for configuring a CGI Nederland service. The object must keep its attributes private, expose setters and getters, validate every assigned value, and apply a sequence of updates in order.
Write build_service_config(initial, updates). It must create a configuration object from the initial values, apply each update through the appropriate setter, and return a dictionary containing the final values obtained through getters.
initial is a dictionary with keys service_name, timeout, retries, and endpoints.service_name is a non-empty string.timeout is a positive integer measured in seconds.retries is an integer from 0 through 5.endpoints is a list of unique, non-empty strings.updates is a list of two-item lists, where each item contains a field name and replacement value. Updates are applied sequentially, so later updates replace earlier ones.service_name, timeout, retries, and endpoints.ValueError.Example 1
initial = {"service_name": "payments", "timeout": 30, "retries": 2, "endpoints": ["api.cgi.nl"]}
updates = [["timeout", 60], ["retries", 4]]
Output: {"service_name": "payments", "timeout": 60, "retries": 4, "endpoints": ["api.cgi.nl"]}
The updates are validated and applied in their listed order.
Example 2
initial = {"service_name": "portal", "timeout": 10, "retries": 0, "endpoints": ["web.cgi.nl", "mobile.cgi.nl"]}
updates = [["endpoints", ["web.cgi.nl"]]]
Output: {"service_name": "portal", "timeout": 10, "retries": 0, "endpoints": ["web.cgi.nl"]}
The endpoint list is replaced through its setter.
1 <= len(service_name) <= 1001 <= timeout <= 36000 <= retries <= 51 <= len(endpoints) <= 1000 <= len(updates) <= 10^4def build_service_config(initial, updates):