Some Python 3 Unicode improvements

There are a few commits regarding Python 3 compatibility, but I could not even get basic.py to work.
I make a few changes so that queries work for me.

The PyString / PyBytes change is not strictly necessary, but makes things more easy to understand when working towards Python 3 compatibility.

I suspect that there are more places that should be changed to accept or return unicode instead of bytes, particularly among the set functions.