please change to `assert np.ndim(indexer) < 2, "indexer.ndim must be < 2. Was %d" % np.ndim(indexer)`  [it won't execute the second part of the statement if the assertion passes.