code: def training_config(
      estimator, inputs=None, job_name=None, mini_batch_size=None
  ):
      """Export Airflow training config from an estimator
  
      Args:
          estimator (sagemaker.estimator.EstimatorBase): The estimator to export
              training config from. Can be a BYO estimator, Framework estimator or
              Amazon algorithm estimator.
          inputs: Information about the training data. Please refer to the ``fit()``
              method of the associated estimator, as this can take any of the following forms:
              * (str) - The S3 location where training data is saved.
  
              * (dict[str, str] or dict[str, sagemaker.inputs.TrainingInput]) - If using multiple
                    channels for training data, you can specify a dict mapping channel names to
                    strings or :func:`~sagemaker.inputs.TrainingInput` objects.
  
              * (sagemaker.inputs.TrainingInput) - Channel configuration for S3 data sources that can
                    provide additional information about the training dataset. See
                    :func:`sagemaker.inputs.TrainingInput` for full details.
  
              * (sagemaker.amazon.amazon_estimator.RecordSet) - A collection of
                    Amazon :class:~`Record` objects serialized and stored in S3.
                    For use with an estimator for an Amazon algorithm.
  
              * (list[sagemaker.amazon.amazon_estimator.RecordSet]) - A list of
                    :class:~`sagemaker.amazon.amazon_estimator.RecordSet` objects,
                    where each instance is a different channel of training data.
          job_name (str): Specify a training job name if needed.
          mini_batch_size (int): Specify this argument only when estimator is a
              built-in estimator of an Amazon algorithm. For other estimators,
              batch size should be specified in the estimator.
  
      Returns:
          dict: Training config that can be directly used by
          SageMakerTrainingOperator in Airflow.
      """
  
      train_config = training_base_config(
          estimator, inputs, job_name, mini_batch_size
      )
  
      train_config["TrainingJobName"] = estimator._current_job_name
  
      if estimator.tags is not None:
          train_config["Tags"] = estimator.tags
  
      if estimator.metric_definitions is not None:
          train_config["AlgorithmSpecification"][
              "MetricDefinitions"
          ] = estimator.metric_definitions
  
      return train_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 4 for calling a global function with example usage: training_config(estimator, inputs, job_name, mini_batch_size) and returns: train_config