code: def maybe_hparams_to_dict(hparams):
      """If :attr:`hparams` is an instance of :class:`~texar.tf.HParams`,
      converts it to a `dict` and returns. If :attr:`hparams` is a `dict`,
      returns as is.
      """
      if hparams is None:
          return None
      if isinstance(hparams, dict):
          return hparams
      return hparams.todict()
  
file_path: texar/texar/tf/utils/dtypes.py
imports: import six
  import numpy
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: maybe_hparams_to_dict(hparams) and returns: hparams, None, hparams