#71, ported to python 3