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
if you need to encode here, something is fundamentally wrong.

this low-level code is expected to get binary data (str for py2, bytes for py3), so you must never need to encode here (but maybe there is a bug on a higher level of the code).