def blacklist(db, term=None):
    mbs = []
    with db.connect() as session:
        if term:
            mbs = session.query(MatchingBlacklist).\
                filter(MatchingBlacklist.excluded.like('%' + term + '%')).\
                order_by(MatchingBlacklist.excluded).all()
            if not mbs:
                raise NotFoundError(entity=term)
        else:
            mbs = session.query(MatchingBlacklist).\
                order_by(MatchingBlacklist.excluded).all()
        session.expunge_all()
    return mbs