Support Python 3

Recreated pull request, after GitHub hiccup with PR #1 (refusing to show diff).