def _get_iface_blocks(data):
    lines, lines6 = [], []
    crt_lines = lines
    for line in data.splitlines():
        line = line.strip()
        if not line or line.startswith("#"):
            continue
        if "iface" in line:
            if "inet6" in line:
                crt_lines = lines6
                continue
            if lines:
                yield lines, lines6
            lines[:] = []
            lines6[:] = []
            crt_lines = lines
        crt_lines.append(line)
    if lines:
        yield lines, lines6
"Yield interface blocks as pairs of v4 and v6 halves.
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/utils/debiface.py/_get_iface_blocks