Python3 compatibility changes.
Merge branch 'master' into py3
Added some Python3 fixes.
More python3 fixes