Add Python 3 compatibility

Closes #17