'Compile and return the given regular expression.'

def _compile(self, regex):

    try:
        return re.compile(regex)
    except re.error as e:
        raise ImproperlyConfigured(('"%s"    is    not    a    valid    regular    expression:    %s' % (regex, e)))
