def _lex(input_string):
    """
    This function returns a list of all character sequences in input_string
    that are divided by whitespace or parentheses, including the
    parentheses themselves.

    >>> _lex('alice & (bob | carol)')
    ['alice', '&', '(', 'bob', '|', 'carol', ')']
    """
    token_list = []
    tmp = ''
    for c in input_string:
        if c not in ' ()!':
            tmp += str(c)
        elif c in '()!':
            if len(tmp) > 0:
                token_list.append(tmp)
                tmp = ''
            token_list.append(str(c))
        else:  # c is white space
            if len(tmp) > 0:
                token_list.append(tmp)
                tmp = ''
    if len(tmp) > 0:
        token_list.append(tmp)
    return token_list