code: def make_handler(
      master_url: str, close_cb: Callable[[int], None]
  ) -> Any:
      class TokenAcceptHandler(BaseHTTPRequestHandler):
          def do_GET(self) -> None:
              try:
                  """Serve a GET request."""
                  token = parse_qs(urlparse(self.path).query)["token"][
                      0
                  ]
                  handle_token(master_url, token)
  
                  self.send_response(200)
                  self.send_header("Content-type", "text/html")
                  self.end_headers()
                  self.wfile.write(b"You can close this window now.")
                  close_cb(0)
              except Exception as e:
                  print("Error authenticating: {}.".format(e))
                  close_cb(1)
  
          def log_message(
              self, format: Any, *args: List[Any]
          ) -> None:  # noqa: A002
              # Silence server logging.
              return
  
      return TokenAcceptHandler
  
file_path: determined/harness/determined/cli/sso.py
imports: import sys
  import webbrowser
  from argparse import Namespace
  from getpass import getpass
  from http.server import BaseHTTPRequestHandler, HTTPServer
  from typing import Any, Callable, List
  from urllib.parse import parse_qs, urlparse
  from determined.common import api
  from determined.common.api import authentication
  from determined.common.declarative_argparse import Arg, Cmd
  from determined.errors import EnterpriseOnlyError
label_desc: Use image node_id 2 for calling a global function with example usage: make_handler(master_url, close_cb) and returns: TokenAcceptHandler