code: def _prepare_loss_weights(loss_weights, output_names):
      """Converts `loss_weights` to a list of float values."""
      if loss_weights is None:
          return [1.0] * len(output_names)
  
      if isinstance(loss_weights, collections.abc.Sequence):
          if len(loss_weights) != len(output_names):
              raise ValueError(
                  "`loss_weights` should have the same number of elements "
                  "as model output"
              )
          return list(map(float, loss_weights))
  
      if isinstance(loss_weights, collections.abc.Mapping):
          for name in output_names:
              if name not in loss_weights:
                  raise ValueError(
                      "Loss weight for {} not found in `loss_weights` "
                      "dictionary.".format(name)
                  )
          return [float(loss_weights[name]) for name in output_names]
  
      raise TypeError(
          "`loss_weights` must be a list or a dict, "
          "got {}".format(str(loss_weights))
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import functools
  import types
  import attr
  import neural_structured_learning.configs
  from neural_structured_learning.lib import adversarial_neighbor
  import six
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: _prepare_loss_weights(loss_weights, output_names) and returns: unknown, list, unknown