def change_selection_state(self, obj):
        """Change object's selection state.

        The change depends on shift key being pressed
        or not and consists of selecting, deselecting or
        turning the object the active selection.
        """
        ### if shift is pressed...

        if KMOD_SHIFT & SERVICES_NS.get_pressed_mod_keys():

            ## if object isn't event selected,
            ## make it so by appending to
            ## 'selected_objs'; also make it the
            ## active object

            if obj not in self.selected_objs:

                self.selected_objs.append(obj)
                self.active_obj = obj

            ## if it is already selected (since
            ## the previous 'if block' failed) and
            ## not active, just make it the active
            ## selection

            elif obj is not self.active_obj:
                self.active_obj = obj

            ## if the object is the active
            ## selection though, unselect it
            ## and set the active obj to another
            ## object or None

            else:

                self.selected_objs.remove(obj)

                try:
                    self.active_obj = self.selected_objs[-1]

                except IndexError:
                    self.active_obj = None

        ### if shift is not pressed, though...

        else:

            ### unselect all objects and keep
            ### the current obj as the only
            ### selected, active one

            self.selected_objs.clear()

            self.selected_objs.append(obj)
            self.active_obj = obj
Change object's selection state.

        The change depends on shift key being pressed
        or not and consists of selecting, deselecting or
        turning the object the active selection.
        
nodezator/editing/selection.py