import re


def _get_last_tree_line(loglines, start_line):
    """Check loglines starting at index start_line and return the number of the 'Explored ... nodes' line"""

    last_line = len(loglines)
    explored = re.compile(r"Explored \d+ nodes")
    for i in range(start_line, len(loglines)):
        if explored.match(loglines[i]):
            break

    return last_line - 1