def streak_next(values, i):
    """Given a list of numbers, skip forward over consecutive streaks

    Used by DfView.find()
    
    If i references a value within a consecutive streak, the value
    returned will be the index of the end of the streak. If i references
    a value at the end of a streak, the value returned will be the
    index of the next streak
    
    Example:
        values = [-1, 3, 4, 5, 10, 11]
        i = 0                 # values[i] =-1
        i = streak_next(x, i) # values[i] = 3
        i = streak_next(x, i) # values[i] = 5
        i = streak_next(x, i) # values[i] = 10
        i = streak_next(x, i) # values[i] = 11
    """
    while i<len(values)-1:
        i+=1
        if i == len(values)-1:
            break
        prev_val=values[i-1]
        curr_val=values[i]
        if curr_val-prev_val>1:
            break
        next_val=values[i+1]
        if next_val-curr_val>1:
            break
    return i