For future reference, there’s a 2to3 program (probably included with your python3 distribution) that can automagically convert a python2 program to python3 (I used that here and it worked fine).
2to3
python3