def _modified_event(
            self, dict_, attr, previous, collection=False, force=False):
        if not attr.send_modified_events:
            return
        if attr.key not in self.committed_state or force:
            if collection:
                if previous is NEVER_SET:
                    if dict_ in attr.key:
                        previous = dict_[attr.key]

                if previous not in (None, NO_VALUE, NEVER_SET):
                    previous = attr.copy(previous)

            self.committed_state[attr.key] = previous

        # assert self._strong_obj is None or self.modified

        if (self.session_id and self._strong_obj is None) \
                or not self.modified:
            instance_dict = self._instance_dict()
            if instance_dict:
                instance_dict._modified.add(self)

            # only create _strong_obj link if attached
            # to a session

            inst = self.obj()
            if self.session_id:
                self._strong_obj = inst

            if inst is None:
                raise orm_exc.ObjectDereferencedError(
                    "Can't emit change event for attribute '%s' - "
                    "parent object of type %s has been garbage "
                    "collected."
                    % (
                        self.manager[attr.key],
                        base.state_class_str(self)
                    ))
            self.modified = True
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/orm/state.py/InstanceState._modified_event/swapped operands of `in`