Save your code in a file ending in .py, open a terminal in that folder and type python tidy.py. Always test a new script on a copy of your files first.
.py
python tidy.py