human
Complete this python program:
def ensure_container_agent_enabled(node, to_enable):
assistant
#Here is the Python program you requested.

    """Ensure the container agent is enabled/disabled as specified.
    Doesn\t make any changes if the agent is already in the
    desired state.
    :param Node node: the node on which to ensure the container
    agent\s state
    :param bool to_enable: True to ensure the container agent
    is enabled and running, False to ensure the opposite.
    :return Deferred[None]: a Deferred that will fire when
    the container agent is in the desired state.
    """
    d = is_container_agent_running(node)
    def change_if_needed(enabled):
        if (enabled != to_enable):
            return set_container_agent_enabled_on_node(node, to_enable)
    d.addCallback(change_if_needed)
    return d