code: def get_initializer(hparams=None):
      """Returns an initializer instance.
  
      .. role:: python(code)
         :language: python
  
      Args:
          hparams (dict or HParams, optional): Hyperparameters with the structure
  
              .. code-block:: python
  
                  {
                      "type": "initializer_class_or_function",
                      "kwargs": {
                          #...
                      }
                  }
  
              The "type" field can be a initializer class, its name or module
              path, or class instance. If class name is provided, the class must
              be from one the following modules:
              :tf_main:`tf.initializers <initializers>`,
              :tf_main:`tf.keras.initializers <keras/initializers>`,
              :tf_main:`tf < >`, and :mod:`texar.tf.custom`. The class is created
              by :python:`initializer_class(**kwargs)`. If a class instance
              is given, "kwargs" is ignored and can be omitted.
  
              Besides, the "type" field can also be an initialization function
              called with :python:`initialization_fn(**kwargs)`. In this case
              "type" can be the function, or its name or module path. If
              function name is provided, the function must be from one of the
              above modules or module `tf.contrib.layers`. If no
              keyword argument is required, "kwargs" can be omitted.
  
      Returns:
          An initializer instance. `None` if :attr:`hparams` is `None`.
      """
      if hparams is None:
          return None
  
      kwargs = hparams.get("kwargs", {})
      if isinstance(kwargs, HParams):
          kwargs = kwargs.todict()
      modules = [
          "tensorflow.initializers",
          "tensorflow.keras.initializers",
          "tensorflow",
          "texar.tf.custom",
      ]
      try:
          initializer = utils.check_or_get_instance(
              hparams["type"], kwargs, modules
          )
      except (TypeError, ValueError):
          modules = ["tensorflow.contrib.layers"] + modules
          initializer_fn = utils.get_function(hparams["type"], modules)
          initializer = initializer_fn(**kwargs)
  
      return initializer
  
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 6 for calling a global function with example usage: get_initializer(hparams) and returns: initializer, None