def _regular_expression_from_set(character_set):
    """Returns a regexp matching any sequence of a set of input characters.
    """
    character_set -= set(range(0x00, 0x20))  # Remove ASCII controls

    literal_list = []
    for code in character_set:
        char = unichr(code)
        if char in ['\\', '[', ']', '^', '-']:
            char = '\\' + char
        literal_list.append(char)
    regexp = '[' + ''.join(literal_list) + ']+'
    return re.compile(regexp)
dataset/ETHPy150Open googlei18n/nototools/nototools/test_vertical_extents.py/_regular_expression_from_set/original