Migration to Python 3

Hmm, yes, I used some 3.3-specific functions in there. I’ll see what I can do about eliminating them. 3.2 has a serious lack functions to easily encode a string for command-line output, though.