def compute_cutline(projection, only_one=False):
    """x0, x1 all included"""
    state = 'start'
    break_pos = []
    x0 = None
    x1 = None
    zero_count = 0
    for i, n in enumerate(projection):
        if state == 'start':
            if n == 0:
                state = 'zero'
            else:
                state = 'none-zero'
                x0 = i
        elif state == 'zero':
            if n != 0:
                state = 'none-zero'
                x0 = i
        elif state == 'none-zero':
            if n == 0:
                state = 'zero'
                x1 = i
                break_pos.append((x0, x1))
    if only_one and len(break_pos) > 1:
        break_pos = [(break_pos[0][0], break_pos[-1][1])]
    return break_pos
