script converted to python 3