code: def authenticated_users_only(
      self, redirect: Optional[bool] = None
  ) -> Callable[[AuthenticatedAIOHTTPHandler], AIOHTTPHandler]:
      def wrap(fun: AuthenticatedAIOHTTPHandler):
          @wraps(fun)
          async def wrapped(request: web.Request) -> web.StreamResponse:
              userdata = await self._fetch_userdata(request)
              if not userdata:
                  # Only web routes should redirect by default
                  if redirect or (
                      redirect is None and "/api/" not in request.path
                  ):
                      raise login_redirect(request)
                  raise web.HTTPUnauthorized()
              return await fun(request, userdata)
  
          return wrapped
  
      return wrap
  
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 1 for calling the Authenticator obj's underlying member method code with example usage: obj.authenticated_users_only(redirect) and returns: wrap, wrapped, unknown