def get_instance_kwargs(kwargs, hparams):
    "Makes a dict of keyword arguments with the following structure:\n\n    `kwargs_ = {'hparams': dict(hparams), **kwargs}`.\n\n    This is typically used for constructing a module which takes a set of\n    arguments as well as a argument named `hparams`.\n\n    Args:\n        kwargs (dict): A dict of keyword arguments. Can be `None`.\n        hparams: A dict or an instance of :class:`~texar.tf.HParams` Can be `None`.\n\n    Returns:\n        A `dict` that contains the keyword arguments in :attr:`kwargs`, and\n        an additional keyword argument named `hparams`.\n    "
    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_
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`.
def get_instance_kwargs(kwargs, hparams):
    "Makes a dict of keyword arguments with the following structure:\n\n    `kwargs_ = {'hparams': dict(hparams), **kwargs}`.\n\n    This is typically used for constructing a module which takes a set of\n    arguments as well as a argument named `hparams`.\n\n    Args:\n        kwargs (dict): A dict of keyword arguments. Can be `None`.\n        hparams: A dict or an instance of :class:`~texar.tf.HParams` Can be `None`.\n\n    Returns:\n        A `dict` that contains the keyword arguments in :attr:`kwargs`, and\n        an additional keyword argument named `hparams`.\n    "
    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_