code: def require_login(func):
      
  
      @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
docs: Function wrapper to signalize that a login is required.