I dislike compiling a new `re` on every call. Can't we check `not isinstance(allowdomain, [str, unicode])`?