def _prepare_regex_pattern(self, p):
        "Recompile unicode regexes as bytes regexes. Overridden in subclass."
        if isinstance(p.pattern, unicode):
            p = re.compile(p.pattern.encode('utf-8'), p.flags &~ re.UNICODE)
        return p