def slicerange(slice, limit):
    """Takes a slice object and returns a range iterator

    :param slice: slice object
    :param limit: maximum value allowed
    :returns: iterator
    """
    return range(*slice.indices(limit))
