code: def validate_token(
      name, token_prefix, authorize, instructions_fn=None
  ):
      """
      Validate that the production token matches that of the deployed flow.
      In case both the user and token do not match, raises an error.
      Optionally outputs instructions on token usage via the provided instruction_fn(flow_name, prev_user)
      """
      # TODO: Unify this with the existing resolve_token implementation.
  
      # 1) retrieve the previous deployment, if one exists
      workflow = ArgoWorkflows.get_existing_deployment(name)
      if workflow is None:
          prev_token = None
      else:
          prev_user, prev_token = workflow
  
      # 2) authorize this deployment
      if prev_token is not None:
          if authorize is None:
              authorize = load_token(token_prefix)
          elif authorize.startswith("production:"):
              authorize = authorize[11:]
  
          # we allow the user who deployed the previous version to re-deploy,
          # even if they don't have the token
          # NOTE: The username is visible in multiple sources, and can be set by the user.
          # Should we consider being stricter here?
          if prev_user != get_username() and authorize != prev_token:
              if instructions_fn:
                  instructions_fn(flow_name=name, prev_user=prev_user)
              raise IncorrectProductionToken(
                  "Try again with the correct production token."
              )
  
      # 3) all validations passed, store the previous token for future use
      token = prev_token
  
      store_token(token_prefix, token)
      return True
  
imports: import base64
  import json
  import platform
  import re
  import sys
  from hashlib import sha1
  from metaflow import JSONType, current, decorators, parameters
  from metaflow._vendor import click
  from metaflow.exception import MetaflowException, MetaflowInternalError
  from metaflow.metaflow_config import ARGO_WORKFLOWS_UI_URL, KUBERNETES_NAMESPACE, SERVICE_VERSION_CHECK, UI_URL
  from metaflow.package import MetaflowPackage
  from metaflow.plugins.aws.step_functions.production_token import load_token, new_token, store_token
  from metaflow.plugins.environment_decorator import EnvironmentDecorator
  from metaflow.plugins.kubernetes.kubernetes_decorator import KubernetesDecorator
  from metaflow.tagging_util import validate_tags
  from metaflow.util import get_username, to_bytes, to_unicode, version_parse
  from .argo_workflows import ArgoWorkflows
label_desc: Use image node_id 13 for calling a global function with example usage: validate_token(name, token_prefix, authorize, instructions_fn) and returns: True