def sethasparent(self, state, parent_state, value):
        msg = "This AttributeImpl is not configured to track parents."
        assert self.trackparent, msg

        id_ = id(self.parent_token)
        if value:
            state.parents[id_] = parent_state
        else:
            if id_ in state.parents:
                last_parent = state.parents[id_]

                if last_parent is not False and \
                        last_parent.key != parent_state.key:

                    if last_parent.obj() is None:
                        raise orm_exc.StaleDataError(
                            "Removing state %s from parent "
                            "state %s along attribute '%s', "
                            "but the parent record "
                            "has gone stale, can't be sure this "
                            "is the most recent parent." %
                            (state_str(state),
                             state_str(parent_state),
                             self.key))

                    return

            state.parents[id_] = False
Set a boolean flag on the given item corresponding to
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py/AttributeImpl.sethasparent