def _find_outer(tokens, token_list):
    """
    This function finds the first occurrence of a token from tokens in
    token_list that is not within parentheses. It returns the partition of
    token_list by this occurrence, meaning that
    result[0] + [token] + result[1] == token_list.
    If there is no such occurrence it returns token_list, None.

    >>> _find_outer('|', ['a', '&', '(', 'b', '|', 'c', ')'])
    (['a', '&', '(', 'b', '|', 'c', ')'], None, None)

    >>> _find_outer('&', ['a', '&', '(', 'b', '|', 'c', ')'])
    (['a'], ['(', 'b', '|', 'c', ')'], '&')
    """
    depth = 0
    for i in range(len(token_list) - 1):
        if depth == 0 and token_list[i] in tokens:
            return (token_list[:i], token_list[i+1:], token_list[i])
        if token_list[i] == '(':
            depth += 1
        if token_list[i] == ')':
            depth -= 1
    return token_list, None, None