def walk_cgroups(cgroup, action, opaque):
    """
    The function applies the action function with the opaque object
    to each control group under the cgroup recursively.
    """
    action(cgroup, opaque)
    for child in cgroup.childs:
        walk_cgroups(child, action, opaque)