def METHOD_NAME(lines):
    """
    Remove ignored lines in ``lines``.
    Args:
        lines (``list[str]``): cell source as a list of strings
    Returns:
        ``list[str]``: stripped version of lines without ignored lines
    """
    ignore_suffix = "# IGNORE"
    stripped = []
    in_block = False
    for line in lines:
        # don't keep the line if it is ignored
        if line.rstrip().endswith(ignore_suffix):
            continue
        # don't keep the line if we're in an ignore block
        if in_block and not line.rstrip().endswith('# END IGNORE'):
            continue
        # process the end of an ignore block
        if line.rstrip().endswith('# END IGNORE'):
            assert in_block, f"END IGNORE without BEGIN IGNORE in {lines}"
            in_block = False
            continue
        # processing the beginning of an ignore block
        if re.match(r"\s*#\s*BEGIN\s*IGNORE\s*", line, flags=re.IGNORECASE):
            assert not in_block, f"Nested BEGIN IGNORE in {lines}"
            in_block = True
            continue
        stripped.append(line)
    assert not in_block, f"BEGIN IGNORE without END IGNORE in {lines}"
    return stripped