Changes for Python 3 compatibility

o dictionary has_key -> in

o StringIO import changed

o Some changes for unicode / str changes.

Not fully working with Python 3 yet