1import py
2html = py.xml.html
3
4class my(html):
5    "a custom style"
6    class body(html.body):
7        style = html.Style(font_size = "120%")
8
9    class h2(html.h2):
10        style = html.Style(background = "grey")
11
12    class p(html.p):
13        style = html.Style(font_weight="bold")
14
15doc = my.html(
16    my.head(),
17    my.body(
18        my.h2("hello world"),
19        my.p("bold as bold can")
20    )
21)
22
23print doc.unicode(indent=2)
24