@staticmethod
def _find_next_eol(output, ind):
    """Find last newline before current position."""
    inext = ind + 1
    while inext < len(output):
        eolnext = output[inext].find('\n')
        if eolnext != -1:
            break
        inext += 1
    else:
        inext = len(output) - 1
        eolnext = len(output[-1]) - 1
    return inext, eolnext
