Support Python 3

All tests pass in 2.7 and 3.4.