def get_hostmask_regex(mask):
 mask = re.escape(mask)
 mask = mask.replace(u'\\*', u'.*')
 return re.compile((mask + u'$'), re.I)

def get_hostmask_regex ( mask ) : mask = re . escape ( mask ) mask = mask . replace ( u'\\*' , u'.*' ) return re . compile ( ( mask + u'$' ) , re . I )
return a compiled re .