<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def allow_unconfirmed_email(view_function):
 """ This decorator ensures that the user is logged in, but allows users with or without a confirmed email addresses to access this particular view. It works in tandem with the ``USER_ALLOW_LOGIN_WITHOUT_CONFIRMED_EMAIL=True`` setting. .. caution:: | Use ``USER_ALLOW_LOGIN_WITHOUT_CONFIRMED_EMAIL=True`` and ``@allow_unconfirmed_email`` with caution, as they relax security requirements. | Make sure that decorated views **never call other views directly**. Allways use ``redirect()`` to ensure proper view protection. Example:: @route('/show_promotion') @allow_unconfirmed_emails def show_promotion():
 # Logged in, with or without It can also precede the ``@roles_required`` and ``@roles_accepted`` view decorators:: @route('/show_promotion') @allow_unconfirmed_emails @roles_required('Visitor') def show_promotion():
 # Logged in, with or without | Calls unauthorized_view() when the user is not logged in. | Calls the decorated view otherwise. """

    @wraps(view_function)    # Tells debuggers that is is a function wrapper
    def decorator(*args, **kwargs):
        # Sets a boolean on the global request context
        g._flask_user_allow_unconfirmed_email = True

        # Catch exceptions to properly unset boolean on exceptions
        try:
            user_manager = current_app.user_manager

            # User must be logged in with a confirmed email address
            allowed = _is_logged_in_with_confirmed_email(user_manager)
            if not allowed:
                # Redirect to unauthenticated page
                return user_manager.unauthenticated_view()

            # It's OK to call the view
            return view_function(*args, **kwargs)

        finally:
            # Allways unset the boolean, whether exceptions occurred or not
            g._flask_user_allow_unconfirmed_email = False

    return decorator