code: def symmetrize_edges(
      dataset: lit_dataset.Dataset,
  ) -> lit_dataset.Dataset:
      """Symmetrize edges by adding copies with span1 and span2 interchanged."""
  
      def _swap(edge):
          return lit_dtypes.EdgeLabel(
              edge.span2, edge.span1, edge.label
          )
  
      edge_fields = utils.find_spec_keys(
          dataset.spec(), lit_types.EdgeLabels
      )
      examples = []
      for ex in dataset.examples:
          new_ex = dict(ex)
          for field in edge_fields:
              new_ex[field] = ex[field] + [
                  _swap(edge) for edge in ex[field]
              ]
          examples.append(new_ex)
      return lit_dataset.Dataset(dataset.spec(), examples)
  
imports: from collections.abc import Sequence
  import os
  import sys
  from typing import Optional
  from absl import app
  from absl import flags
  from absl import logging
  from lit_nlp import dev_server
  from lit_nlp import server_flags
  from lit_nlp.api import dataset
  from lit_nlp.api import dtypes
  from lit_nlp.api import layout
  from lit_nlp.api import types
  from lit_nlp.examples.coref import edge_predictor
  from lit_nlp.examples.coref import encoders
  from lit_nlp.examples.coref import model
  from lit_nlp.examples.coref.datasets import ontonotes
  from lit_nlp.examples.coref.datasets import winogender
  from lit_nlp.lib import file_cache
  from lit_nlp.lib import utils
label_desc: Use image node_id 2 for calling a global function with example usage: symmetrize_edges(dataset) and returns: lit_dataset, lit_dtypes