Python Create Regex Pattern From Frequency