code: def run_test(
      target_call,
      num_steps,
      strategy,
      batch_size=None,
      log_steps=100,
      num_steps_per_batch=1,
      iterator=None,
  ):
      """Run benchmark and return TimeHistory object with stats.
  
      Args:
        target_call: Call to execute for each step.
        num_steps: Number of steps to run.
        strategy: None or tf.distribute.DistibutionStrategy object.
        batch_size: Total batch size.
        log_steps: Interval of steps between logging of stats.
        num_steps_per_batch: Number of steps per batch. Used to account for total
          number of transitions or examples processed per iteration.
        iterator: Iterator for each execute step
  
      Returns:
        TimeHistory object containing step performance stats.
      """
      history = TimeHistory(batch_size, log_steps, num_steps_per_batch)
  
      for _ in range(num_steps):
          history.on_batch_begin()
          if strategy:
              if iterator:
                  strategy.run(target_call, args=(next(iterator),))
              else:
                  strategy.run(target_call)
          else:
              if iterator:
                  target_call(next(iterator))
              else:
                  target_call()
          history.on_batch_end()
  
      return history
  
imports: import datetime
  import os
  import time
  from typing import Dict, Optional, Tuple
  from absl import logging
  import numpy
  from six.moves import range
  from six.moves import zip
  import tensorflow
  from tensorflow.core.util import event_pb2
  from tensorflow.python.lib.io import tf_record
label_desc: Use image node_id 1 for calling a global function with example usage: run_test(target_call, num_steps, strategy, batch_size, log_steps, num_steps_per_batch, iterator) and returns: history