def parse_slice(s, size):
    """
    Helper to determine nonnegative integers (start, stop, step) of a slice.

    :param slice s: A slice.
    :param int size: The size of the array being indexed into.
    :returns: A tuple of nonnegative integers ``start, stop, step``.
    :rtype: tuple
    """
    start = s.start
    if start is None:
        start = 0
    assert isinstance(start, int)
    if start >= 0:
        start = min(size, start)
    else:
        start = max(0, size + start)

    stop = s.stop
    if stop is None:
        stop = size
    assert isinstance(stop, int)
    if stop >= 0:
        stop = min(size, stop)
    else:
        stop = max(0, size + stop)

    step = s.step
    if step is None:
        step = 1
    assert isinstance(step, int)

    return start, stop, step