Refartoring for python 3
Refartoring for python 3