'Call sqlalchemy\'s one and recast errors to serializable errors if any.
:raises exceptions.ObjectNotFound: if no model is found
:raises exceptions.InconsistentDatabase: if more than one model is found'

def _one_with_recast_errors(self, query):

    try:
        return query.one()
    except sqlalchemy.orm.exc.NoResultFound:
        raise exceptions.ObjectNotFound((self.model_class.__name__ + '    not    found'))
    except sqlalchemy.orm.exc.MultipleResultsFound:
        raise exceptions.InconsistentDatabase(('found    more    than    one    ' + self.model_class.__name__))
