def __getitem__(self, index):
        if isinstance(index, tuple) and any([isinstance(i, slice) for i in index]):

            def slice_expand(s, dim):
                if not isinstance(s, slice):
                        return (s,)
                start, stop, step = s.indices(dim)
                return [start + i*step for i in range((stop-start)//step)]

            sl_factors = [slice_expand(i, dim) for (i, dim) in zip(index, self.shape)]
            eindices = itertools.product(*sl_factors)
            array = [self._array[self._parse_index(i)] for i in eindices]
            nshape = [len(el) for i, el in enumerate(sl_factors) if isinstance(index[i], slice)]
            return type(self)(array, nshape)
        else:
            if isinstance(index, slice):
                return self._array[index]
            else:
                index = self._parse_index(index)
                return self._array[index]
Allows to get items from N-dim array.
dataset/ETHPy150Open sympy/sympy/sympy/tensor/array/dense_ndim_array.py/DenseNDimArray.__getitem__