def trim_to_sel(self, *args):
        if len(self.selection) > 0:
            selected_keys = [sel.text for sel in self.selection]
            first_sel_index = self.sorted_keys.index(selected_keys[0])
            last_sel_index = self.sorted_keys.index(selected_keys[-1])
            desired_keys = self.sorted_keys[first_sel_index:last_sel_index + 1]
            self.data = dict([(key, self.data[key]) for key in desired_keys])
Cut list items with indices in sorted_keys that are les than or
dataset/ETHPy150Open kivy/kivy/kivy/adapters/dictadapter.py/DictAdapter.trim_to_sel