Added Python3 support. Now Python 2 or 3 can be used with the same code

The code is runnable with Python3 and Python2 now. Tested with Python 2.7 and Python 3.3.
Please write code in the future for Python 2 and 3, so both are supported
I added this there and it did not raise an assertion error no matter what I tried (with python 2):

        t = unicode
        assert not isinstance(data, t), "we want str/bytes, not unicode"

maybe you could just add this code with t = str for py3 and see where it blows up and then fix the caller.