'Create new instance of Rule(regex, types, attrs, stop)'

def __new__(_cls, regexes, types=None, stop=False, flexible_whitespace=True, **kwargs):

    if (isinstance(regexes, string_types) or hasattr(regexes, 'match')):
        regexes = (regexes,)
    compiled_regexes = []
    for regex in regexes:
        if isinstance(regex, string_types):
            if flexible_whitespace:
                regex = re.sub('\\s{1,4}', '\\s{,10}', regex)
            compiled_regexes.append(re.compile(regex))
        else:
            compiled_regexes.append(regex)
    if isinstance(types, string_types):
        types = set([types])
    types = set((types or []))
    return tuple.__new__(_cls, (compiled_regexes, types, stop, kwargs))
