Fixed so it works in Python 3

Thought I'd use six but didn't (which I still find too hard to believe to remove it).