<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def samples_keep(self, index):
 """ Keep subset of samples. If index is an integer, keep last N=index samples. If index is a list, keep the samples corresponding to the index values in the list. """


        try:
            if isinstance(index, (int, long)):
                index = range(self.samples)[-index:]
        except(NameError):
            if isinstance(index,int):
                index = range(self.samples)[-index:]            
        self.sampled_topics = np.take(self.sampled_topics, index, axis=0)
        self.tt = np.take(self.tt, index, axis=2)
        self.dt = np.take(self.dt, index, axis=2)

        self.samples = len(index)