def make_re(mask):
 as_string = ''.join(mask)
 r = (('[^' + re.escape(as_string)) + ']')
 return re.compile(r)

def make_re ( mask ) : as_string = '' . join ( mask ) r = ( ( '[^' + re . escape ( as_string ) ) + ']' ) return re . compile ( r )
makes a regex from an iterable of characters .