code: def correct_html(self, root, children, div_math, insert_idx, text):
          
  
          current_idx = 0
  
          for idx in div_math:
              el = markdown.util.etree.Element('p')
              el.text = text
              el.extend(children[current_idx:idx])
  
              # Test to ensure that empty <p> is not inserted  
              if len(el) != 0 or (el.text and not el.text.isspace()):
                 root.insert(insert_idx, el)
                 insert_idx += 1
  
              text = children[idx].tail
              children[idx].tail = None
              root.insert(insert_idx, children[idx])
              insert_idx += 1
              current_idx = idx+1
  
          el = markdown.util.etree.Element('p')
          el.text = text
          el.extend(children[current_idx:])
  
          if len(el) != 0 or (el.text and not el.text.isspace()):
              root.insert(insert_idx, el)
docs: Separates out <div class="math"> from the parent tag <p>. Anything
          in between is put into its own parent tag of <p>