<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_unique_identity(db, uuid):
 """Add a unique identity to the registry. This function adds a unique identity to the registry. First, it checks if the unique identifier (uuid) used to create the identity is already on the registry. When it is not found, a new unique identity is created. Otherwise, it raises a 'AlreadyExistError' exception. :param db: database manager :param uuid: unique identifier for the identity :raises InvalidValueError: when uuid is None or an empty string :raises AlreadyExistsError: when the identifier already exists in the registry. """

    with db.connect() as session:
        try:
            add_unique_identity_db(session, uuid)
        except ValueError as e:
            raise InvalidValueError(e)