fix py3 compat, using six

all tests are successful on py 2.6 and 3.3.

note: the one small bugfix changeset should be also applied to master branch (if you merge all these this into a new sprint-branch in your repo, not master).