<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def slice(self, rindex):
 """Slice the DMatrix and return a new DMatrix that only contains `rindex`. Parameters rindex : list List of indices to be selected. Returns ------- res : DMatrix A new DMatrix containing only selected indices. """

        res = DMatrix(None, feature_names=self.feature_names)
        res.handle = ctypes.c_void_p()
        _check_call(_LIB.XGDMatrixSliceDMatrix(self.handle,
                                               c_array(ctypes.c_int, rindex),
                                               len(rindex),
                                               ctypes.byref(res.handle)))
        return res