porting to Python 3