code: def login_redirect(request) -> web.HTTPFound:
      login_url = deploy_config.external_url("auth", "/login")
  
      # request.url is a yarl.URL
      request_url = request.url
      x_forwarded_host = request.headers.get("X-Forwarded-Host")
      if x_forwarded_host:
          request_url = request_url.with_host(x_forwarded_host)
      x_forwarded_proto = request.headers.get("X-Forwarded-Proto")
      if x_forwarded_proto:
          request_url = request_url.with_scheme(x_forwarded_proto)
  
      return web.HTTPFound(
          f"{login_url}?next={urllib.parse.quote(str(request_url))}"
      )
  
imports: import abc
  import asyncio
  import logging
  import urllib.parse
  from functools import wraps
  from typing import Awaitable, Callable, Optional, Tuple, TypedDict
  import aiohttp
  import aiohttp_session
  from aiohttp import web
  from hailtop import httpx
  from hailtop.config import get_deploy_config
  from hailtop.utils import retry_transient_errors
  from .time_limited_max_size_cache import TimeLimitedMaxSizeCache
label_desc: Use image node_id 2 for calling a global function with example usage: login_redirect(request) and returns: web