code: def login_required(fn):
      
      @wraps(fn)
      async def wrapped(*args, **kwargs):
          request = args[-1]
          if not isinstance(request, web.BaseRequest):
              msg = ("Incorrect decorator usage. "
                     "Expecting `def handler(request)` "
                     "or `def handler(self, request)`.")
              raise RuntimeError(msg)
  
          await check_authorized(request)
          return await fn(*args, **kwargs)
  
      warnings.warn("login_required decorator is deprecated, "
                    "use check_authorized instead",
                    DeprecationWarning)
      return wrapped
docs: Decorator that restrict access only for authorized users.
  
      User is considered authorized if authorized_userid
      returns some value.