def break_iterable(iterable, pred):
sublist = []<EOL>for i in iterable:<EOL><INDENT>if pred(i):<EOL><INDENT>yield sublist<EOL>sublist = []<EOL><DEDENT>else:<EOL><INDENT>sublist.append(i)<EOL><DEDENT><DEDENT>yield sublist<EOL>
Break a iterable on the item that matches the predicate into lists.

    The item that matched the predicate is not included in the result.

    >>> list(break_iterable([1, 2, 3, 4], lambda x: x == 3))
    [[1, 2], [4]]