code: def _canonicalize_experiment(exp):
      """Sorts the repeated fields of an Experiment message."""
      exp.hparam_infos.sort(key=operator.attrgetter("name"))
      exp.metric_infos.sort(
          key=operator.attrgetter("name.group", "name.tag")
      )
      for hparam_info in exp.hparam_infos:
          if hparam_info.HasField("domain_discrete"):
              hparam_info.domain_discrete.values.sort(
                  key=operator.attrgetter("string_value")
              )
  
imports: import operator
  from unittest import mock
  import tensorflow
  from google.protobuf import text_format
  from tensorboard import context
  from tensorboard.data import provider
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import backend_context
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.hparams import plugin_data_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _canonicalize_experiment(exp) without return types