code: def prepare_amazon_algorithm_estimator(
      estimator, inputs, mini_batch_size=None
  ):
      """Sets up amazon algorithm estimator.
  
      This is done by adding the required `feature_dim` hyperparameter from training data.
  
      Args:
          estimator (sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase): An estimator
              for a built-in Amazon algorithm to get information from and update.
          inputs: The training data.
             * (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.
          mini_batch_size:
      """
      if isinstance(inputs, list):
          for record in inputs:
              if (
                  isinstance(record, amazon_estimator.RecordSet)
                  and record.channel == "train"
              ):
                  estimator.feature_dim = record.feature_dim
                  break
      elif isinstance(inputs, amazon_estimator.RecordSet):
          estimator.feature_dim = inputs.feature_dim
      else:
          raise TypeError(
              "Training data must be represented in RecordSet or list of RecordSets"
          )
      estimator.mini_batch_size = mini_batch_size
  
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 2 for calling a global function with example usage: prepare_amazon_algorithm_estimator(estimator, inputs, mini_batch_size) without return types