code: def requires_authentication(function: T):
      """Decorate functions that require authentication."""
  
      @wraps(function)
      def decorated(*args, **kwargs):
          if not get_auth_manager().is_logged_in():
              return Response("Unauthorized", 401, {})
          return function(*args, **kwargs)
  
      return cast(T, decorated)
  
imports: from __future__ import annotations
  from functools import wraps
  from typing import Any, Callable, TypeVar, cast
  from flask import Response
  from airflow.www.extensions.init_auth_manager import get_auth_manager
label_desc: Use image node_id 2 for calling a global function with example usage: requires_authentication(function) and returns: cast, function, Response