code: def add_checkpoint(html_note, counter):
      
      if html_note.text:
          html_note.text = (html_note.text + CHECKPOINT_PREFIX +
                            str(counter) + CHECKPOINT_SUFFIX)
      else:
          html_note.text = (CHECKPOINT_PREFIX + str(counter) +
                            CHECKPOINT_SUFFIX)
      counter += 1
  
      for child in html_note.iterchildren():
          counter = add_checkpoint(child, counter)
  
      if html_note.tail:
          html_note.tail = (html_note.tail + CHECKPOINT_PREFIX +
                            str(counter) + CHECKPOINT_SUFFIX)
      else:
          html_note.tail = (CHECKPOINT_PREFIX + str(counter) +
                            CHECKPOINT_SUFFIX)
      counter += 1
  
      return counter
docs: Recursively adds checkpoints to html tree.