porting from python2-python3