Compat

Replaces #14, which I screwed up.

Lots of stupid changes to get python3 to work. Mostly around unicode/byte strings :(