<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _find_last_line_index(contents):
 """Find the last line of the headerblock in contents."""

    lineno = 0
    headerblock = re.compile(r"^{0}.*$".format(_ALL_COMMENT))

    if not len(contents):
        raise RuntimeError("""File does not not have any contents""")

    while headerblock.match(contents[lineno]):
        if lineno + 1 == len(contents):
            raise RuntimeError("""No end of headerblock in file""")
        lineno = lineno + 1

    if lineno < 2:
        raise RuntimeError("""Headerblock must have at least two lines""")

    return lineno - 1