code: def test_algorithm_train_instance_types_valid_instance_types(session):
      session.sagemaker_config = {}
      describe_algo_response = copy.deepcopy(
          DESCRIBE_ALGORITHM_RESPONSE
      )
      instance_types = ["ml.m4.xlarge", "ml.m5.2xlarge"]
  
      describe_algo_response["TrainingSpecification"][
          "SupportedTrainingInstanceTypes"
      ] = instance_types
  
      session.sagemaker_client.describe_algorithm = Mock(
          return_value=describe_algo_response
      )
  
      AlgorithmEstimator(
          algorithm_arn="arn:aws:sagemaker:us-east-2:1234:algorithm/scikit-decision-trees",
          role="SageMakerRole",
          instance_type="ml.m4.xlarge",
          instance_count=1,
          sagemaker_session=session,
      )
  
      AlgorithmEstimator(
          algorithm_arn="arn:aws:sagemaker:us-east-2:1234:algorithm/scikit-decision-trees",
          role="SageMakerRole",
          instance_type="ml.m5.2xlarge",
          instance_count=1,
          sagemaker_session=session,
      )
  
imports: from __future__ import absolute_import
  import copy
  import datetime
  import pytest
  from mock import Mock, patch
  from sagemaker.algorithm import AlgorithmEstimator
  from sagemaker.estimator import _TrainingJob
  from sagemaker.transformer import Transformer
label_desc: Use image node_id 5 for calling a global function with example usage: test_algorithm_train_instance_types_valid_instance_types(session) without return types