code: def _convert_to_dict(x):
      """Converts input to `dict`."""
      if isinstance(x, collections.OrderedDict):
          return x
      if hasattr(x, "_asdict"):
          # Wrap with `OrderedDict` to indicate that namedtuples have a well-defined
          # order (by default, they convert to just `dict` in Python 3.8+).
          return collections.OrderedDict(x._asdict())
      return dict(x)
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import distribution_util
label_desc: Use image node_id 5 for calling a global function with example usage: _convert_to_dict(x) and returns: dict, x, collections