Replace A Pattern In Python Using Random