Add Python 3 compatibility.

Mostly just print statements. The other options make almost no
difference here.