Ported to Python3.2 mostly via 2to3 tool.

This work was performed by Tejashri Kandolkar and Sandeep Shelke.