Porting to python 3.x. Stage #1.