Python 3.X compatibility

I made the library compatible with 3.X, though there are probably still string encoding bugs because of the way Python 3 handles strings. Importantly, the library should still behave identically on python 2.X.