code: def _create_extractor(col_param):
      if col_param.HasField("metric"):
          return _create_metric_extractor(col_param.metric)
      elif col_param.HasField("hparam"):
          return _create_hparam_extractor(col_param.hparam)
      else:
          raise error.HParamsError(
              'Got ColParam with both "metric" and "hparam" fields unset: %s'
              % col_param
          )
  
imports: import collections
  import dataclasses
  import operator
  import re
  from typing import Optional
  from google.protobuf import struct_pb2
  from tensorboard.data import provider
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import backend_context
  from tensorboard.plugins.hparams import error
  from tensorboard.plugins.hparams import json_format_compat
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.hparams import metrics
  from tensorboard.plugins.hparams import plugin_data_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: _create_extractor(col_param) and returns: _create_metric_extractor, _create_hparam_extractor