Porting to python3