back up of python script as of 29/07/2013