def fuse_slice_pair(slice0, slice1, length):
    """computes slice `s` such that array[s] = array[s0][s1] where array has length `length`"""
    start0, stop0, step0 = slice0.indices(length)
    start1, stop1, step1 = slice1.indices(len(range(start0, stop0, step0)))
    stop01 = start0 + stop1 * step0
    return slice(start0 + start1 * step0, None if stop01 < 0 else stop01, step0 * step1)