Replace Regular Expression Python Definition Function