code: def validate_token(
      name, token_prefix, authorize, instruction_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 = StepFunctions.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 instruction_fn:
                  instruction_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
  from metaflow._vendor import click
  from hashlib import sha1
  import json
  import re
  from metaflow import current, decorators, parameters, JSONType
  from metaflow.metaflow_config import SERVICE_VERSION_CHECK, SFN_STATE_MACHINE_PREFIX, UI_URL
  from metaflow.exception import MetaflowException, MetaflowInternalError
  from metaflow.package import MetaflowPackage
  from metaflow.plugins.aws.batch.batch_decorator import BatchDecorator
  from metaflow.tagging_util import validate_tags
  from metaflow.util import get_username, to_bytes, to_unicode, version_parse
  from .step_functions import StepFunctions
  from .production_token import load_token, store_token, new_token
label_desc: Use image node_id 11 for calling a global function with example usage: validate_token(name, token_prefix, authorize, instruction_fn) and returns: True