code: def get_instance_type_quota_code(
      instance_type: str, spot: bool = False
  ) -> str:
      match = re.match("([a-z]+)[0-9]+.+", instance_type)
      if not match:
          raise PreflightFailure("can't detect instance class")
  
      instance_class = match.group(1).capitalize()
      quota_map = SPOT_QUOTA_CODES if spot else ON_DEMAND_QUOTA_CODES
      quota_code = quota_map.get(instance_class, quota_map[None])
  
      return quota_code
  
file_path: determined/harness/determined/deploy/aws/preflight.py
imports: import re
  import sys
  from typing import Any, Dict
  import boto3
  import pkg_resources
  from botocore.exceptions import ClientError
  from termcolor import colored
  from determined.common import util, yaml
  from determined.deploy.aws import constants
  from determined.deploy.errors import PreflightFailure
  from .deployment_types.base import DeterminedDeployment
label_desc: Use image node_id 1 for calling a global function with example usage: get_instance_type_quota_code(instance_type, spot) and returns: quota_code