code: def _dcg(
      label,
      rank,
      weight=1.0,
      gain_fn=lambda l: math.pow(2.0, l) - 1.0,
      rank_discount_fn=lambda r: 1.0 / math.log(r + 1.0, 2.0),
  ):
      """Returns a single dcg addend.
  
      Args:
        label: The document label.
        rank: The document rank starting from 1.
        weight: The document weight.
        gain_fn: (function) Transforms labels.
        rank_discount_fn: (function) The rank discount function.
  
      Returns:
        A single dcg addend. e.g. weight*(2^relevance-1)/log2(rank+1).
      """
      return weight * gain_fn(label) * rank_discount_fn(rank)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import tensorflow
  from tensorflow_ranking.python import metrics
label_desc: Use image node_id 1 for calling a global function with example usage: _dcg(label, rank, weight, gain_fn, rank_discount_fn) and returns: unknown