def isplit(start_text, iterator):
    """Returns head, match, tail tuple, where match is the first line that starts with `start_text`"""
    head = []
    iterator = iter(iterator)
    for item in iterator:
        if item.startswith(start_text):
            return head, item, iterator
        head.append(item)
    return head, None, iterator