def move_up(self):
        if self._real_id is None or self._index is None:
            pass
        classobj = self.__class__
        if self.__group_by__ is not None and hasattr(classobj, self.__group_by__):
            group_by_field = getattr(classobj, self.__group_by__)
        else:
            group_by_field = None
        # get max_index of record with index less than this object
        query = self.session.query(func.max(classobj._index).label("max_index"))
        if group_by_field is None:
            query = query.filter(classobj._index < self._index).one()
        else:
            group_by_value = getattr(self, self.__group_by__)
            query = query.filter(self._index < classobj._index, group_by_field==group_by_value).one()
        max_index = query.max_index
        if max_index is None:
            max_index = 0
        else:
            max_index = int(max_index)
        # get object with index =  max_index
        query = self.session.query(classobj)
        if group_by_field is not None:
            group_by_value = getattr(self, self.__group_by__)
            query = query.filter(group_by_field == group_by_value, classobj._index == max_index)
        else:
            query = query.filter(classobj._index == max_index)
        # neighbor
        try:
            neighbor = query.one()
            current_index = self._index
            self._index = neighbor._index
            neighbor._index = current_index
            DB_Model.save(self)
            DB_Model.save(neighbor)
            return True
        except NoResultFound, _:
            return False
dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/model.py/Ordered_DB_Model.move_up/swapped operands of `<`