Replace A Pattern In Python Using Return