code: def migrate_event(event, initial_metadata):
      """Migrate an event to a sequence of events.
  
      Args:
        event: An `event_pb2.Event`. The caller transfers ownership of the
          event to this method; the event may be mutated, and may or may
          not appear in the returned sequence.
        initial_metadata: Map from tag name (string) to `SummaryMetadata`
          proto for the initial occurrence of the given tag within the
          enclosing run. While loading a given run, the caller should
          always pass the same dictionary here, initially `{}`; this
          function will mutate it and reuse it for future calls.
  
      Returns:
        A sequence of `event_pb2.Event`s to use instead of `event`.
      """
      what = event.WhichOneof("what")
      if what == "graph_def":
          return _migrate_graph_event(event)
      if what == "tagged_run_metadata":
          return _migrate_tagged_run_metadata_event(event)
      if what == "summary":
          return _migrate_summary_event(event, initial_metadata)
      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 1 for calling a global function with example usage: migrate_event(event, initial_metadata) and returns: event, _migrate_graph_event, _migrate_tagged_run_metadata_event, _migrate_summary_event