code: def _get_metric_pair(key, weight=None, topn=None):
      """Helper function to construct metric name and function."""
      name = "".join(
          [
              "metric/",
              "weighted_" if weight else "",
              key,
              "_%s" % topn if topn else "",
          ]
      )
      return name, metrics.make_ranking_metric_fn(
          key, weights_feature_name=weight, topn=topn
      )
  
imports: import tensorflow
  from tensorflow import estimator
  from tensorflow.python.util import function_utils
  from tensorflow_ranking.python import feature
  from tensorflow_ranking.python import head
  from tensorflow_ranking.python import losses
  from tensorflow_ranking.python import metrics
  from tensorflow_ranking.python import model
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 3 for calling a global function with example usage: _get_metric_pair(key, weight, topn) and returns: name,  metrics