def nol(mlstring, start=None, end=None):
    """
    Return number of lines in the multi-line string ``mlstring``.

    Optional arguments ``start`` and ``end`` have the same meaning as in
    a string's ``count`` method.
    """
    if start is None:
        start = 0
    if end is None:
        end = len(mlstring)
    if '\r' in mlstring:
        return mlstring.count('\r', start, end) + 1
    else:
        return mlstring.count('\n', start, end) + 1
