def nol(txt, start=None, end=None):
    """
    Return number of lines in the multi-line string txt.
    """
    if start is None:
        start = 0
    if end is None:
        end = len(txt)
    if '\r' in txt:
        return txt.count('\r', start, end) + 1
    else:
        return txt.count('\n', start, end) + 1
