code: def test_launch_templates(
      ec2_client_stub,
      ec2_client_stub_fail_fast,
      ec2_client_stub_max_retries,
  ):
      # given the launch template associated with our default head node type...
      # expect to first describe the default launch template by ID
      stubs.describe_launch_template_versions_by_id_default(
          ec2_client_stub, ["$Latest"]
      )
      # given the launch template associated with our default worker node type...
      # expect to next describe the same default launch template by name
      stubs.describe_launch_template_versions_by_name_default(
          ec2_client_stub, ["2"]
      )
      # use default stubs to skip ahead to subnet configuration
      stubs.configure_key_pair_default(ec2_client_stub)
  
      # given the security groups associated with our launch template...
      sgids = [DEFAULT_SG["GroupId"]]
      security_groups = [DEFAULT_SG]
      # expect to describe all security groups to ensure they share the same VPC
      stubs.describe_sgs_by_id(ec2_client_stub, sgids, security_groups)
  
      # use a default stub to skip subnet configuration
      stubs.configure_subnet_default(ec2_client_stub)
  
      # given our mocks and an example config file as input...
      # expect the config to be loaded, validated, and bootstrapped successfully
      config = helpers.bootstrap_aws_example_config_file(
          "example-launch-templates.yaml"
      )
  
      # instantiate a new node provider
      new_provider = _get_node_provider(
          config["provider"],
          DEFAULT_CLUSTER_NAME,
          False,
      )
  
      max_count = 1
      for name, node_type in config["available_node_types"].items():
          # given our bootstrapped node config as input to create a new node...
          # expect to first describe all stopped instances that could be reused
          stubs.describe_instances_with_any_filter_consumer(
              ec2_client_stub_max_retries
          )
          # given no stopped EC2 instances to reuse...
          # expect to create new nodes with the given launch template config
          node_cfg = node_type["node_config"]
          stubs.run_instances_with_launch_template_consumer(
              ec2_client_stub_fail_fast,
              config,
              node_cfg,
              name,
              DEFAULT_LT["LaunchTemplateData"],
              max_count,
          )
          tags = helpers.node_provider_tags(config, name)
          new_provider.create_node(node_cfg, tags, max_count)
  
      ec2_client_stub.assert_no_pending_responses()
      ec2_client_stub_fail_fast.assert_no_pending_responses()
      ec2_client_stub_max_retries.assert_no_pending_responses()
  
imports: import copy
  from unittest.mock import Mock, patch
  import pytest
  from click.exceptions import ClickException
  import ray.tests.aws.utils.helpers
  import ray.tests.aws.utils.stubs
  from ray.autoscaler._private.aws.config import DEFAULT_AMI, _configure_subnet, _get_subnets_or_die, bootstrap_aws, log_to_cli
  from ray.autoscaler._private.aws.node_provider import AWSNodeProvider
  from ray.autoscaler._private.providers import _get_node_provider
  from ray.tests.aws.utils.constants import AUX_SG, AUX_SUBNET, CUSTOM_IN_BOUND_RULES, DEFAULT_CLUSTER_NAME, DEFAULT_INSTANCE_PROFILE, DEFAULT_KEY_PAIR, DEFAULT_LT, DEFAULT_SG, DEFAULT_SG_AUX_SUBNET, DEFAULT_SG_DUAL_GROUP_RULES, DEFAULT_SG_WITH_NAME, DEFAULT_SG_WITH_NAME_AND_RULES, DEFAULT_SG_WITH_RULES, DEFAULT_SG_WITH_RULES_AUX_SUBNET, DEFAULT_SUBNET
label_desc: Use image node_id 14 for calling a global function with example usage: test_launch_templates(ec2_client_stub, ec2_client_stub_fail_fast, ec2_client_stub_max_retries) without return types