def group_by_marker(seq, marker):
    group = []
for line in seq:
    if marker(line):
        group = [line]
break
for line in seq:
    if marker(line) and group:
        yield group
group = []
group.append(line)
if group:
    yield group
Extract multiple line data between two symbols - Regex and Python3