How to access multi-level nested items?

sublevel = [] # list of checkboxes

def add_sublevel(cb):
  global sublevel
  sublevel.append(cb)

def set_sublevel_checked(checked):
  for cb in sublevel:
    cb.checked = checked

Something like that maybe where you import the module into the relevant forms and call the relevant methods.