def numberDocument(document, chapterNumber):
    i = 1
    for node in domhelpers.findNodesNamed(document, "h2"):
        label = dom.Text()
        label.data = "%s.%d " % (chapterNumber, i)
        node.insertBefore(label, node.firstChild)
        i += 1
Number the sections of the given document.
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/lore/tree.py/numberDocument