Revert "python 3 compatibility"

This reverts commit 7e788a8c60a7f65cc017c626b823b7c1b5bfb1ff.
Revert "Revert "python 3 compatibility""

This reverts commit da67ede9c96c89c0ce1a5186a8853f3080c98a16.
fix for python 2.6