<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_cdn_access(self, container, public, ttl=None):
 """ Enables or disables CDN access for the specified container, and optionally sets the TTL for the container when enabling access. """

        headers = {"X-Cdn-Enabled": "%s" % public}
        if public and ttl:
            headers["X-Ttl"] = ttl
        self.api.cdn_request("/%s" % utils.get_name(container), method="PUT",
                headers=headers)