Py script is now more general