Python script corrected