code: def get_instance_kwargs(kwargs, hparams):
      """Makes a dict of keyword arguments with the following structure:
  
      `kwargs_ = {'hparams': dict(hparams), **kwargs}`.
  
      This is typically used for constructing a module which takes a set of
      arguments as well as a argument named `hparams`.
  
      Args:
          kwargs (dict): A dict of keyword arguments. Can be `None`.
          hparams: A dict or an instance of :class:`~texar.tf.HParams` Can be `None`.
  
      Returns:
          A `dict` that contains the keyword arguments in :attr:`kwargs`, and
          an additional keyword argument named `hparams`.
      """
      if hparams is None or isinstance(hparams, dict):
          kwargs_ = {"hparams": hparams}
      elif isinstance(hparams, HParams):
          kwargs_ = {"hparams": hparams.todict()}
      else:
          raise ValueError(
              "`hparams` must be a dict, an instance of HParams, or a `None`."
          )
      kwargs_.update(kwargs or {})
      return kwargs_
  
imports: from typing import List, Union
  import inspect
  import funcsigs
  from pydoc import locate
  import copy
  import collections
  import numpy
  import tensorflow
  from texar.tf.hyperparams import HParams
  from texar.tf.utils.dtypes import is_str, is_callable, compat_as_text, _maybe_list_to_array
label_desc: Use image node_id 13 for calling a global function with example usage: get_instance_kwargs(kwargs, hparams) and returns: kwargs_