<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_range(self, sampfrom=0, sampto=None):
 """ Filter the annotation attributes to keep only items between the desired sample values """

        sampto = sampto or self.sample[-1]

        kept_inds = np.intersect1d(np.where(self.sample>=sampfrom),
                                   np.where(self.sample<=sampto))


        for field in ['sample', 'label_store', 'subtype', 'chan', 'num']:
            setattr(self, field, getattr(self, field)[kept_inds])

        self.aux_note = [self.aux_note[i] for i in kept_inds]

        self.ann_len = len(self.sample)