def chunk_on(pipeline, new_chunk_signal, output_type=tuple):
    ''' split the stream into seperate chunks based on a new chunk signal '''
    assert iterable(pipeline), 'chunks needs pipeline to be iterable'
    assert callable(new_chunk_signal), 'chunks needs new_chunk_signal to be callable'
    assert callable(output_type), 'chunks needs output_type to be callable'
    
    out = deque()
    for i in pipeline:
        if new_chunk_signal(i) and len(out): # if new chunk start detected
            yield output_type(out)
            out.clear()
        out.append(i)
    # after looping, if there is anything in out, yield that too
    if len(out):
        yield output_type(out)
split the stream into seperate chunks based on a new chunk signal