def count_str(text, sub, start=None, end=None):
    """
    Computes the number of non-overlapping occurrences of substring ``sub`` in ``text[start:end]``.
    
    Optional arguments start and end are interpreted as in slice notation.
    
    :param text: The string to search
    :type text:  ``str``
    
    :param sub: The substring to count
    :type sub:  ``str``
    
    :param start: The start of the search range
    :type start:  ``int``
    
    :param end: The end of the search range
    :type end:  ``int``
    
    :return: The number of non-overlapping occurrences of substring ``sub`` in ``text[start:end]``.
    :rtype:  ``int``
    """
    assert isinstance(text,str), '%s is not a string' % text
    return text.count(sub,start,end)