code: def define_regularizer(function):
      """
      Wraps regularization function and uses it in order to apply
      regularization per each parameter in the network.
  
      Examples
      --------
      >>> import tensorflow as tf
      >>> from neupy import algorithms
      >>> from neupy.layers import *
      >>>
      >>> @algorithms.define_regularizer
      ... def l2(weight, decay_rate=0.01):
      ...     return decay_rate * tf.reduce_sum(tf.pow(weight, 2))
      ...
      >>> l2_regularizer = l2(dacay_rate=0.01)
      >>> network = Input(5) >> Relu(10) >> Sigmoid(1)
      >>> reguarization_cost = l2_regularizer(network)
      """
  
      @wraps(function)
      def wrapper(*args, **kwargs):
          return Regularizer(function, *args, **kwargs)
  
      return wrapper
  
file_path: neupy/neupy/algorithms/gd/regularizers.py
imports: from __future__ import division
  from functools import wraps
  import tensorflow
  from neupy.utils import asfloat
label_desc: Use image node_id 1 for calling a global function with example usage: define_regularizer(function) and returns: wrapper, Regularizer