<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def split(pred, iterable, *, trailing=True):
 """Split the iterable. Arguments pred : function A function that accepts an element retrieved from the iterable and returns a boolean indicating if it is the element on which to split iterable : iterable trailing : boolean Indicates whether the split should occur on the leading edge of the match on the split or on the trailing edge of the match on the split Returns ------- The generator produces a list for each split. If *trailing* is True then the element that was identified by the predicate will be returned at the end of each split. If *trailing* is False then the element that was identified by the predicate will be returned at the beginning of the following split. No guarantee is made regarding the state of the iterable during operation. """

    result = []
    result_append = result.append
    if trailing:
        for elem in iterable:
            result_append(elem)
            if pred(elem):
                yield result
                result = []
                result_append = result.append
    else:
        for elem in iterable:
            if pred(elem):
                if result:
                    yield result
                result = []
                result_append = result.append
            result_append(elem)
    if result:
        yield result