<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_id(self, Id, is_added, index):
 """Update selected_ids and emit dataChanged"""

        if is_added:
            self.selected_ids.add(Id)
        else:
            self.selected_ids.remove(Id)
        self.dataChanged.emit(index, index)