code: def test_deploy_config_from_amazon_alg_estimator(sagemaker_session):
      knn_estimator = knn.KNN(
          role="{{ role }}",
          instance_count="{{ instance_count }}",
          instance_type="ml.m4.xlarge",
          k=16,
          sample_size=128,
          predictor_type="regressor",
          sagemaker_session=sagemaker_session,
      )
  
      record = amazon_estimator.RecordSet(
          "{{ record }}", 10000, 100, "S3Prefix"
      )
  
      # simulate training
      airflow.training_config(
          knn_estimator, record, mini_batch_size=256
      )
  
      config = airflow.deploy_config_from_estimator(
          estimator=knn_estimator,
          task_id="task_id",
          task_type="tuning",
          initial_instance_count="{{ instance_count }}",
          instance_type="ml.p2.xlarge",
      )
      expected_config = {
          "Model": {
              "ModelName": "knn-%s" % TIME_STAMP,
              "PrimaryContainer": {
                  "Image": "174872318107.dkr.ecr.us-west-2.amazonaws.com/knn:1",
                  "Environment": {},
                  "ModelDataUrl": "s3://output/{{ ti.xcom_pull(task_ids='task_id')['Tuning']['BestTrainingJob']"
                  "['TrainingJobName'] }}/output/model.tar.gz",
              },
              "ExecutionRoleArn": "{{ role }}",
          },
          "EndpointConfig": {
              "EndpointConfigName": "knn-%s" % TIME_STAMP,
              "ProductionVariants": [
                  {
                      "InstanceType": "ml.p2.xlarge",
                      "InitialInstanceCount": "{{ instance_count }}",
                      "ModelName": "knn-%s" % TIME_STAMP,
                      "VariantName": "AllTraffic",
                      "InitialVariantWeight": 1,
                  }
              ],
          },
          "Endpoint": {
              "EndpointName": "knn-%s" % TIME_STAMP,
              "EndpointConfigName": "knn-%s" % TIME_STAMP,
          },
      }
  
      assert config == expected_config
  
imports: from __future__ import absolute_import
  import pytest
  from mock import Mock, MagicMock, patch
  from sagemaker import chainer, estimator, model, mxnet, tensorflow, transformer, tuner, processing
  from sagemaker.network import NetworkConfig
  from sagemaker.processing import ProcessingInput, ProcessingOutput
  from sagemaker.workflow import airflow
  from sagemaker.amazon import amazon_estimator
  from sagemaker.amazon import knn, linear_learner, ntm, pca
label_desc: Use image node_id 23 for calling a global function with example usage: test_deploy_config_from_amazon_alg_estimator(sagemaker_session) without return types