First steps toward Python3 compatibility.

Some stuff is working OK with Python 3, but there's certainly more to be
done.