Hyccup is a port of Hiccup for Hy, a Lisp embed in Python.
It allows you to represent HTML into data structure and to dump it.
=> (import hyccup [html])
=> (html ["div" {"class" "my-class" "id" "my-id"} "Hello Hyccup"])
"<div class=\"my-class\" id=\"my-id\">Hello Hyccup</div>"
Hyccup can also be used in Python:
>>> from hyccup import html
>>> html(['div', {'class': 'my-class', 'id': 'my-id'}, 'Hello Hyccup'])
'<div class="my-class" id="my-id">Hello Hyccup</div>'
More information in the documentation.