def find_subsections(section):
 result = []
 for child in section.children:
  if isinstance(child, nodes.section):
   result.append(child)
   continue
  result.extend(find_subsections(child))
 return result

def find_subsections ( section ) : result = [ ] for child in section . children : if isinstance ( child , nodes . section ) : result . append ( child ) continue result . extend ( find_subsections ( child ) ) return result
return a list of subsections for the given section .