The great python 3 port of issue #2