

def get_or_create(model, **kwargs):
    from sqlalchemy.orm.exc import NoResultFound
    try:
        return model.query.filter_by(**kwargs).one()
    except NoResultFound:
        return kwargs(**kwargs)

dataset/ETHPy150Open svetlyak40wt/gtdzen/gtdzen/utils.py get_or_create/VarMisuse@48/58 `model`->`kwargs`