code: def get_regularizer(hparams=None):
      """Returns a variable regularizer instance.
  
      See :func:`~texar.tf.core.default_regularizer_hparams` for all
      hyperparameters and default values.
  
      The "type" field can be a subclass
      of :tf_main:`Regularizer <keras/regularizers/Regularizer>`, its string name
      or module path, or a class instance.
  
      Args:
          hparams (dict or HParams, optional): Hyperparameters. Missing
              hyperparameters are set to default values.
  
      Returns:
          A :tf_main:`Regularizer <keras/regularizers/Regularizer>` instance.
          `None` if :attr:`hparams` is `None` or taking the default
          hyperparameter value.
  
      Raises:
          ValueError: The resulting regularizer is not an instance of
              :tf_main:`Regularizer <keras/regularizers/Regularizer>`.
      """
      if hparams is None:
          return None
  
      if isinstance(hparams, dict):
          hparams = HParams(hparams, default_regularizer_hparams())
  
      rgl = utils.check_or_get_instance(
          hparams.type,
          hparams.kwargs.todict(),
          ["tensorflow.keras.regularizers", "texar.tf.custom"],
      )
  
      if not isinstance(rgl, tf.keras.regularizers.Regularizer):
          raise ValueError(
              "The regularizer must be an instance of "
              "tf.keras.regularizers.Regularizer."
          )
  
      if (
          isinstance(rgl, tf.keras.regularizers.L1L2)
          and rgl.l1 == 0.0
          and rgl.l2 == 0.0
      ):
          return None
  
      return rgl
  
imports: import copy
  import tensorflow
  import tensorflow.contrib.rnn
  from texar.tf.hyperparams import HParams
  from texar.tf.utils import utils
  from texar.tf.utils.dtypes import is_str
  from texar.tf.utils.variables import add_variable
  from texar.tf.utils.mode import is_train_mode, switch_dropout
label_desc: Use image node_id 5 for calling a global function with example usage: get_regularizer(hparams) and returns: rgl, None, None