tidy up python script