code: def regularize_layer_params_weighted(
      layers, penalty, tags={"regularizable": True}, **kwargs
  ):
      """
      Computes a regularization cost by applying a penalty to the parameters
      of a layer or group of layers, weighted by a coefficient for each layer.
  
      Parameters
      ----------
      layers : dict
          A mapping from :class:`Layer` instances to coefficients.
      penalty : callable
      tags: dict
          Tag specifications which filter the parameters of the layer or layers.
          By default, only parameters with the `regularizable` tag are included.
      **kwargs
          keyword arguments passed to penalty.
  
      Returns
      -------
      Theano scalar
          a scalar expression for the cost
      """
      return sum(
          coeff
          * apply_penalty(layer.get_params(**tags), penalty, **kwargs)
          for layer, coeff in layers.items()
      )
  
file_path: Lasagne/lasagne/regularization.py
imports: import theano.tensor
  from .layers import Layer, get_all_params
label_desc: Use image node_id 5 for calling a global function with example usage: regularize_layer_params_weighted(layers, penalty, tags) and returns: sum