quick hack for python3 support. encode and decode work. I'm not a python expert so ymmv