<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def require_login(func):
 """ Function wrapper to signalize that a login is required. """


    @wraps(func)
    def decorated(*args, **kwargs):
        auth = request.authorization
        if not auth:
            return authenticate()

        user = session.query(User).filter(
            User.name == auth.username
        ).first()
        if user and user.check(auth.password):
            g.user = user
            return func(*args, **kwargs)
        else:
            return authenticate()

    return decorated