code: def get_profiler_callback(
      model_dir, profile_steps, enable_tensorboard, steps_per_epoch
  ):
      """Validate profile_steps flag value and return profiler callback."""
      profile_steps_error_message = (
          "profile_steps must be a comma separated pair of positive integers, "
          "specifying the first and last steps to be profiled."
      )
      try:
          profile_steps = [int(i) for i in profile_steps.split(",")]
      except ValueError:
          raise ValueError(profile_steps_error_message)
      if len(profile_steps) != 2:
          raise ValueError(profile_steps_error_message)
      start_step, stop_step = profile_steps
      if start_step < 0 or start_step > stop_step:
          raise ValueError(profile_steps_error_message)
      if enable_tensorboard:
          tf.compat.v1.logging.warn(
              "Both TensorBoard and profiler callbacks are used. Note that the "
              "TensorBoard callback profiles the 2nd step (unless otherwise "
              "specified). Please make sure the steps profiled by the two callbacks "
              "do not overlap."
          )
      return ProfilerCallback(
          model_dir, start_step, stop_step, steps_per_epoch
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import time
  import tensorflow
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python import tf2
  from tensorflow.python.eager import profiler
label_desc: Use image node_id 1 for calling a global function with example usage: get_profiler_callback(model_dir, profile_steps, enable_tensorboard, steps_per_epoch) and returns: ProfilerCallback