This bothered me too. I was hoping the this would be automatically optimised by the Python intepreter, but I can't be sure.

The test `not isinstance(allowdomain, [str, unicode])` would work equally well, but makes the code sensitive to failure if another type is added to the list in the future.
The middle ground is to store the result of `type(re.compile(''))` in another variable, and test that.
Pick any of the above.