code: def dict_fetch(src_dict, tgt_dict_or_keys):
      """Fetches a sub dict of :attr:`src_dict` with the keys in
      :attr:`tgt_dict_or_keys`.
  
      Args:
          src_dict: A dict or instance of :class:`~texar.tf.HParams`.
              The source dict to fetch values from.
          tgt_dict_or_keys: A dict, instance of :class:`~texar.tf.HParams`,
              or a list (or a dict_keys) of keys to be included in the output
              dict.
  
      Returns:
          A new dict that is a subdict of :attr:`src_dict`.
      """
      if src_dict is None:
          return src_dict
  
      if isinstance(tgt_dict_or_keys, HParams):
          tgt_dict_or_keys = tgt_dict_or_keys.todict()
      if isinstance(tgt_dict_or_keys, dict):
          tgt_dict_or_keys = tgt_dict_or_keys.keys()
      keys = list(tgt_dict_or_keys)
  
      if isinstance(src_dict, HParams):
          src_dict = src_dict.todict()
  
      return {k: src_dict[k] for k in keys if k in src_dict}
  
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 16 for calling a global function with example usage: dict_fetch(src_dict, tgt_dict_or_keys) and returns: unknown, src_dict