Python 3 support

Changed to python library to work both on Python 2 and Python 3 using the six library.
right, i mean you could store `bytearray(str, 'utf8')` in a var and just use that, instead of encoding potentially a lot of data twice