Python: fix dendrogram printing on Python 3.x, thanks to Jeremy Kun