code: def deploy_config_from_estimator(
      estimator,
      task_id,
      task_type,
      initial_instance_count,
      instance_type,
      model_name=None,
      endpoint_name=None,
      tags=None,
      **kwargs,
  ):
      """Export Airflow deploy config from a SageMaker estimator
  
      Args:
          estimator (sagemaker.model.EstimatorBase): The SageMaker estimator to
              export Airflow config from. It has to be an estimator associated
              with a training job.
          task_id (str): The task id of any
              airflow.contrib.operators.SageMakerTrainingOperator or
              airflow.contrib.operators.SageMakerTuningOperator that generates
              training jobs in the DAG. The endpoint config is built based on the
              training job generated in this operator.
          task_type (str): Whether the task is from SageMakerTrainingOperator or
              SageMakerTuningOperator. Values can be 'training', 'tuning' or None
              (which means training job is not from any task).
          initial_instance_count (int): Minimum number of EC2 instances to deploy
              to an endpoint for prediction.
          instance_type (str): Type of EC2 instance to deploy to an endpoint for
              prediction, for example, 'ml.c4.xlarge'.
          model_name (str): Name to use for creating an Amazon SageMaker model. If
              not specified, one will be generated.
          endpoint_name (str): Name to use for creating an Amazon SageMaker
              endpoint. If not specified, the name of the SageMaker model is used.
          tags (list[dict]): List of tags for labeling a training job. For more,
              see https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
          **kwargs: Passed to invocation of ``create_model()``. Implementations
              may customize ``create_model()`` to accept ``**kwargs`` to customize
              model creation during deploy. For more, see the implementation docs.
  
      Returns:
          dict: Deploy config that can be directly used by
          SageMakerEndpointOperator in Airflow.
      """
      update_estimator_from_task(estimator, task_id, task_type)
      model = estimator.create_model(**kwargs)
      model.name = model_name
      config = deploy_config(
          model,
          initial_instance_count,
          instance_type,
          endpoint_name,
          tags,
      )
      return config
  
imports: from __future__ import print_function, absolute_import
  import os
  import re
  import sagemaker
  from sagemaker import fw_utils, job, utils, s3, session, vpc_utils
  from sagemaker.amazon import amazon_estimator
  from sagemaker.tensorflow import TensorFlow
  from sagemaker.estimator import EstimatorBase
  from sagemaker.processing import Processor
  from sagemaker.utils import format_tags
label_desc: Use image node_id 18 for calling a global function with example usage: deploy_config_from_estimator(estimator, task_id, task_type, initial_instance_count, instance_type, model_name, endpoint_name, tags) and returns: config