'Indexing using logical indexing or a list of indices.
Parameters
expr : Expression
The expression being indexed/sliced into.
key : tuple
ndarrays or lists.
Returns
Expression
An expression representing the index/slice.'

@staticmethod
def get_special_slice(expr, key):

    expr = index.cast_to_const(expr)
    idx_mat = np.arange((expr.size[0] * expr.size[1]))
    idx_mat = np.reshape(idx_mat, expr.size, order='F')
    select_mat = idx_mat[key]
    if (select_mat.ndim == 2):
        final_size = select_mat.shape
    else:
        final_size = (select_mat.size, 1)
    select_vec = np.reshape(select_mat, select_mat.size, order='F')
    identity = sp.eye((expr.size[0] * expr.size[1])).tocsc()
    return reshape((identity[select_vec] * vec(expr)), *final_size)
