protect against broken repr in lib.pretty

for example:

```python
from lxml import html
import urllib2
from IPython.display import display

term = 'cat'
data = html.parse("""http://en.wiktionary.org/w/index.php?title=%s&printable=yes""" % urllib2.quote(term.encode('utf-8')), parser=html.HTMLParser(encoding="utf-8"))
d = data.xpath(".//div[@id='mw-content-text']")[0]
display(d.getchildren())
```