code: def check_quotas(
      det_config: Dict[str, Any],
      deployment_object: DeterminedDeployment,
  ) -> None:
      try:
          boto_session: boto3.session.Session = det_config[
              constants.cloudformation.BOTO3_SESSION
          ]
          gpu_instance_type = get_cf_parameter(
              det_config,
              deployment_object,
              constants.cloudformation.COMPUTE_AGENT_INSTANCE_TYPE,
          )
          max_agents = get_cf_parameter(
              det_config,
              deployment_object,
              constants.cloudformation.MAX_DYNAMIC_AGENTS,
          )
          spot_enabled = get_cf_parameter(
              det_config,
              deployment_object,
              constants.cloudformation.SPOT_ENABLED,
          )
  
          quota_code = get_instance_type_quota_code(
              gpu_instance_type, spot=spot_enabled
          )
          vcpu_quota = fetch_instance_type_quota(
              boto_session, quota_code=quota_code
          )
  
          mapping_fn = pkg_resources.resource_filename(
              "determined.deploy.aws", "vcpu_mapping.yaml"
          )
          with open(mapping_fn) as fin:
              mapping_data = util.safe_load_yaml_with_exceptions(fin)
              vcpu_mapping = {
                  d["instanceType"]: d for d in mapping_data
              }
  
          if gpu_instance_type not in vcpu_mapping:
              raise PreflightFailure(
                  "unknown vCPU count for instance type"
              )
  
          vcpus_required = int(
              vcpu_mapping[gpu_instance_type]["vcpu"] * max_agents
          )
      except PreflightFailure as ex:
          print(
              colored(
                  "Failed to check AWS instance quota: %s" % ex,
                  "yellow",
              )
          )
          return
      except Exception as ex:
          print(
              colored(
                  "Error while checking AWS instance quota: %s" % ex,
                  "yellow",
              )
          )
          return
  
      if vcpus_required > vcpu_quota:
          print(
              colored(
                  "Insufficient AWS GPU agent instance quota (available: %s, required: %s)"
                  % (vcpu_quota, vcpus_required),
                  "red",
              )
          )
          print(
              "You can request a quota increase at "
              "https://%s.console.aws.amazon.com/servicequotas/home/services/ec2/quotas"
              % boto_session.region_name
          )
          print("Required quota code: %s" % quota_code)
          print(
              "This check can be skipped via `det deploy --no-preflight-checks ...`"
          )
          sys.exit(1)
  
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 5 for calling a global function with example usage: check_quotas(det_config, deployment_object) without return types