code: def dist_to_funsor(pyro_dist, event_inputs=()):
      """
      Convert a PyTorch distribution to a Funsor.
  
      :param torch.distribution.Distribution: A PyTorch distribution.
      :return: A funsor.
      :rtype: funsor.terms.Funsor
      """
      assert isinstance(pyro_dist, torch.distributions.Distribution)
      assert isinstance(event_inputs, tuple)
      return to_funsor(
          pyro_dist,
          Real,
          default_dim_to_name(pyro_dist.batch_shape, event_inputs),
      )
  
imports: import math
  from collections import OrderedDict
  import torch
  import funsor.ops
  from funsor.cnf import Contraction
  from funsor.delta import Delta
  from funsor.domains import Array, Bint, Real, Reals
  from funsor.gaussian import Gaussian
  from funsor.interpreter import gensym
  from funsor.tensor import Tensor
  from funsor.terms import Independent, Variable, to_data, to_funsor
label_desc: Use image node_id 5 for calling a global function with example usage: dist_to_funsor(pyro_dist, event_inputs) and returns: to_funsor