Python 3 support (take 2) [Part 1 of 2]

Recreated #400 to fix github errors