class_docstr: :param trace_dist: a TracePosterior instance representing a Monte Carlo posterior
  
  Marginal histogram distribution.
  Turns a TracePosterior object into a Distribution
  over the return values of the TracePosterior's model.
docstr: Recursively converts a dictionary to a list of key-value tuples
  Only intended for use as a helper function inside HashingMarginal!!
  May break when keys cant be sorted, but that is not an expected use-case
docstr_tok: ["Recursively","converts","a","dictionary","to","a","list","of","key-value","tuples","Only","intended","for","use","as","a","helper","function","inside","HashingMarginal","!","!","May","break","when","keys","cant","be","sorted",",","but","that","is","not","an","expected","use-case"]
code: def _dict_to_tuple(self, d):
      """
      Recursively converts a dictionary to a list of key-value tuples
      Only intended for use as a helper function inside HashingMarginal!!
      May break when keys cant be sorted, but that is not an expected use-case
      """
      if isinstance(d, dict):
          return tuple(
              [(k, self._dict_to_tuple(d[k])) for k in sorted(d.keys())]
          )
      else:
          return d
  
imports: import collections
  import functools
  import queue
  import torch
  import pyro.distributions
  import pyro.poutine
  from pyro.distributions.util import logsumexp
  from pyro.infer.abstract_infer import TracePosterior
  from pyro.poutine.runtime import NonlocalExit
label_desc: Use image node_id 6 for calling the HashingMarginal obj's underlying member method code with example usage: obj._dict_to_tuple(d) and returns: tuple, d