def isplit(start_text, iterator):
 head = []
 iterator = iter(iterator)
 for item in iterator:
  if item.startswith(start_text):
   return (head, item, iterator)
  head.append(item)
 return (head, None, iterator)

def isplit ( start_text , iterator ) : head = [ ] iterator = iter ( iterator ) for item in iterator : if item . startswith ( start_text ) : return ( head , item , iterator ) head . append ( item ) return ( head , None , iterator )
behaves like str .