code: def get_mtl_loss_weights(args, targets):
      flattened_targets = [y for x in targets.values() for y in x]
  
      loss_weights = {
          target: float(
              args[
                  f"{MtlArgsPrefix.LOSS_WEIGHT_ARG_PREFIX.value}{target}"
              ]
          )
          if f"{MtlArgsPrefix.LOSS_WEIGHT_ARG_PREFIX.value}{target}"
          in args
          else 1.0
          for target in flattened_targets
      }
  
      mtl_loss_weights = {}
      if Task.BINARY_CLASSIFICATION.value in targets:
          mtl_loss_weights.update(
              {
                  f"{target}/binary_output": loss_weights[target]
                  for target in targets[
                      Task.BINARY_CLASSIFICATION.value
                  ]
              }
          )
      if Task.REGRESSION.value in targets:
          mtl_loss_weights.update(
              {
                  f"{target}/regression_output": loss_weights[target]
                  if target in loss_weights
                  else 1.0
                  for target in targets[Task.REGRESSION.value]
              }
          )
  
      return mtl_loss_weights
  
imports: import merlin.models.tf
  from tensorflow.keras import regularizers
  from .args_parsing import MtlArgsPrefix, Task
label_desc: Use image node_id 2 for calling a global function with example usage: get_mtl_loss_weights(args, targets) and returns: mtl_loss_weights