code: def split_before(iterable, pred):
      
      buf = []
      for item in iterable:
          if pred(item) and buf:
              yield buf
              buf = []
          buf.append(item)
      yield buf
docs: Yield lists of items from *iterable*, where each list starts with an
      item where callable *pred* returns ``True``:
  
          >>> list(split_before('OneTwo', lambda s: s.isupper()))
          [['O', 'n', 'e'], ['T', 'w', 'o']]
  
          >>> list(split_before(range(10), lambda n: n % 3 == 0))
          [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]