WiP py3 fix.
Continuation of 7d85ef3.