def take_nd(self, indexer, axis, new_mgr_locs=None, fill_tuple=None):
<EOL>values = self.values<EOL>if self.is_sparse:<EOL><INDENT>values = self.get_values()<EOL><DEDENT>if fill_tuple is None:<EOL><INDENT>fill_value = self.fill_value<EOL>new_values = algos.take_nd(values, indexer, axis=axis,<EOL>allow_fill=False, fill_value=fill_value)<EOL><DEDENT>else:<EOL><INDENT>fill_value = fill_tuple[<NUM_LIT:0>]<EOL>new_values = algos.take_nd(values, indexer, axis=axis,<EOL>allow_fill=True, fill_value=fill_value)<EOL><DEDENT>if new_mgr_locs is None:<EOL><INDENT>if axis == <NUM_LIT:0>:<EOL><INDENT>slc = libinternals.indexer_as_slice(indexer)<EOL>if slc is not None:<EOL><INDENT>new_mgr_locs = self.mgr_locs[slc]<EOL><DEDENT>else:<EOL><INDENT>new_mgr_locs = self.mgr_locs[indexer]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>new_mgr_locs = self.mgr_locs<EOL><DEDENT><DEDENT>if not is_dtype_equal(new_values.dtype, self.dtype):<EOL><INDENT>return self.make_block(new_values, new_mgr_locs)<EOL><DEDENT>else:<EOL><INDENT>return self.make_block_same_class(new_values, new_mgr_locs)<EOL><DEDENT>
Take values according to indexer and return them as a block.bb