def count_tup(tupl, value, start=None, end=None):
    """
    Counts the number of times ``value`` occurs in ``tupl[start:end]``.
    
    Optional arguments start and end are interpreted as in slice notation.
    
    :param tupl: The tuple to search
    :type tupl:  ``tuple``
    
    :param value: The value to count
    :type value:  ``any``
    
    :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 times ``value`` occurs in ``tupl[start:end]``.
    :rtype:  ``int``
    """
    assert type(tupl) == tuple, '%s is not a tuple' % tupl
    return tupl[start:end].count(value)