Python3.x related changes added

Code is updated for Python3.x