Replace A Pattern In Python Code