def METHOD_NAME(self, **query):
    result = self._db.query(GradingInfo).filter_by(**query).one_or_none()
    if result is None:
        result = GradingInfo(**query)
        self._db.add(result)
    return result