def add_to_matching_blacklist(db, entity):
    """Add entity to the matching blacklist.

    This function adds an 'entity' o term to the matching blacklist.
    The term to add cannot have a None or empty value, in this case
    a InvalidValueError will be raised. If the given 'entity' exists in the
    registry, the function will raise an AlreadyExistsError exception.

    :param db: database manager
    :param entity: term, word or value to blacklist

    :raises InvalidValueError: raised when entity is None or an empty string
    :raises AlreadyExistsError: raised when the entity already exists
        in the registry.
    """
    with db.connect() as session:
        try:
            add_to_matching_blacklist_db(session, entity)
        except ValueError as e:
            raise InvalidValueError(e)
Add entity to the matching blacklist.

    This function adds an 'entity' o term to the matching blacklist.
    The term to add cannot have a None or empty value, in this case
    a InvalidValueError will be raised. If the given 'entity' exists in the
    registry, the function will raise an AlreadyExistsError exception.

    :param db: database manager
    :param entity: term, word or value to blacklist

    :raises InvalidValueError: raised when entity is None or an empty string
    :raises AlreadyExistsError: raised when the entity already exists
        in the registry.