code: def make_loss_fn(
      loss_keys: Union[str, Sequence[str]],
      loss_weights: Optional[Sequence[Union[float, int]]] = None,
      weights_feature_name: Optional[str] = None,
      lambda_weight: Optional[losses_impl._LambdaWeight] = None,
      reduction: tf.compat.v1.losses.Reduction = tf.compat.v1.losses.Reduction.SUM_BY_NONZERO_WEIGHTS,
      name: Optional[str] = None,
      params: Optional[Mapping[str, Any]] = None,
      gumbel_params: Optional[Mapping[str, Any]] = None,
  ) -> utils.LossFunction:
      """Makes a loss function using a single loss or multiple losses.
  
      Args:
        loss_keys: A string or list of strings representing loss keys defined in
          `RankingLossKey`. Listed loss functions will be combined in a weighted
          manner, with weights specified by `loss_weights`. If `loss_weights` is
          None, default weight of 1 will be used. The loss_keys could also be of
          form 'mean_squared_loss:0.1,softmax_loss:0.9' in which case it will be
          parsed as a list of loss keys `['mean_squared_loss', 'softmax_loss']`
          and corresponding loss weights `[0.1, 0.9]`.
        loss_weights: List of weights, same length as `loss_keys`. Used when merging
          losses to calculate the weighted sum of losses. If `None`, all losses are
          weighted equally with weight being 1.
        weights_feature_name: A string specifying the name of the weights feature in
          `features` dict.
        lambda_weight: A `_LambdaWeight` object created by factory methods like
          `create_ndcg_lambda_weight()`.
        reduction: One of `tf.losses.Reduction` except `NONE`. Describes how to
          reduce training loss over batch.
        name: A string used as the name for this loss.
        params: A string-keyed dictionary that contains any other loss-specific
          arguments.
        gumbel_params: A string-keyed dictionary that contains other
          `gumbel_softmax_sample` arguments.
  
      Returns:
        A function _loss_fn(). See `_loss_fn()` for its signature.
  
      Raises:
        ValueError: If `reduction` is invalid.
        ValueError: If `loss_keys` is None or empty.
        ValueError: If `loss_keys` and `loss_weights` have different sizes.
      """
      return _LossFunctionMaker(
          loss_keys,
          loss_weights,
          weights_feature_name,
          lambda_weight,
          reduction,
          name,
          params,
          gumbel_params,
      ).make()
  
imports: from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union
  import tensorflow
  from tensorflow_ranking.python import losses_impl
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 1 for calling a global function with example usage: make_loss_fn(loss_keys, loss_weights, weights_feature_name, lambda_weight, reduction, name, params, gumbel_params) and returns: _LossFunctionMaker