python script revised