<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_select(self, item, action):
 """ Add an action to make when an object is selected. Only one action can be stored this way. """


        if not isinstance(item, int):
            item = self.items.index(item)

        self._on_select[item] = action