'Get an element from a sparse N-dim array.
Examples
>>> from sympy import MutableSparseNDimArray
>>> a = MutableSparseNDimArray(range(4), (2, 2))
>>> a
[[0, 1], [2, 3]]
>>> a[0, 0]
0
>>> a[1, 1]
3
>>> a[0]
0
>>> a[2]
2
Symbolic indexing:
>>> from sympy.abc import i, j
>>> a[i, j]
[[0, 1], [2, 3]][i, j]
Replace `i` and `j` to get element `(0, 0)`:
>>> a[i, j].subs({i: 0, j: 0})
0'

def __getitem__(self, index):

    syindex = self._check_symbolic_index(index)
    if (syindex is not None):
        return syindex
    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._sparse_array.get(self._parse_index(i), S.Zero) for i in eindices]
        nshape = [len(el) for (i, el) in enumerate(sl_factors) if isinstance(index[i], slice)]
        return type(self)(array, nshape)
    elif isinstance(index, slice):
        (start, stop, step) = index.indices(self._loop_size)
        retvec = [self._sparse_array.get(ind, S.Zero) for ind in range(start, stop, step)]
        return retvec
    else:
        index = self._parse_index(index)
        return self._sparse_array.get(index, S.Zero)
