code: def finalizeSection(section):
      
      cur = section.first_child
      last = section.last_child
      if last is not None:
          last.nxt = None
  
      while cur is not None:
          cur.parent = section
          cur = cur.nxt
docs: Correct the nxt and parent for each child