code: def _migrate_summary_event(event, initial_metadata):
      values = event.summary.value
      new_values = [
          new
          for old in values
          for new in _migrate_value(old, initial_metadata)
      ]
      # Optimization: Don't create a new event if there were no shallow
      # changes (there may still have been in-place changes).
      if len(values) == len(new_values) and all(
          x is y for (x, y) in zip(values, new_values)
      ):
          return (event,)
      del event.summary.value[:]
      event.summary.value.extend(new_values)
      return (event,)
  
imports: from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.plugins.audio import metadata
  from tensorboard.plugins.custom_scalar import metadata
  from tensorboard.plugins.graph import metadata
  from tensorboard.plugins.histogram import metadata
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.image import metadata
  from tensorboard.plugins.mesh import metadata
  from tensorboard.plugins.pr_curve import metadata
  from tensorboard.plugins.scalar import metadata
  from tensorboard.plugins.text import metadata
  from tensorboard.util import tensor_util
label_desc: Use image node_id 4 for calling a global function with example usage: _migrate_summary_event(event, initial_metadata) and returns: event, event