code: def _flatten_dict(dict_, parent_key="", sep="."):
      """Flattens a nested dictionary. Namedtuples within
      the dictionary are converted to dicts.
  
      Args:
        dict_: The dictionary to flatten.
        parent_key: A prefix to prepend to each key.
        sep: Separator between parent and child keys, a string. For example
          { "a": { "b": 3 } } will become { "a.b": 3 } if the separator is ".".
  
      Returns:
        A new flattened dictionary.
      """
      items = []
      for key, value in dict_.items():
          new_key = parent_key + sep + key if parent_key else key
          if isinstance(value, collections.MutableMapping):
              items.extend(
                  _flatten_dict(value, new_key, sep=sep).items()
              )
          elif isinstance(value, tuple) and hasattr(value, "_asdict"):
              dict_items = collections.OrderedDict(
                  zip(value._fields, value)
              )
              items.extend(
                  _flatten_dict(dict_items, new_key, sep=sep).items()
              )
          else:
              items.append((new_key, value))
      return dict(items)
  
file_path: seq2seq/seq2seq/models/model_base.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import collections
  import tensorflow
  from seq2seq.configurable import Configurable
  from seq2seq.training import utils
  from seq2seq import global_vars
label_desc: Use image node_id 1 for calling a global function with example usage: _flatten_dict(dict_, parent_key, sep) and returns: dict