Dominate
Dominate is a Python library for creating and manipulating HTML docs
... and the .add() method you can easily create more advanced structures. By default, render() tries to make all output human readable, with one HTML element per line and two spaces of indentation.