def get_or_create(session, model, defaults=None, **kwargs):
    instance = session.query(model).filter_by(**kwargs).first()
    if instance:
        return instance, False
    else:
        params = dict(
            (k, v) for k, v in kwargs.iteritems() if not isinstance(v, ClauseElement))
        params.update(defaults and {})
        instance = model(**params)
        session.add(instance)
        return instance, True
dataset/ETHPy150Open Pegase745/gitlab-freak/gitlab_freak/helpers.py/get_or_create/operator `or` -> `and`