code: def test_mvn_to_funsor(batch_shape, event_shape, event_sizes):
      event_size = sum(event_sizes)
      mvn = random_mvn(batch_shape + event_shape, event_size)
      int_inputs = OrderedDict(
          (k, Bint[size]) for k, size in zip("abc", event_shape)
      )
      real_inputs = OrderedDict(
          (k, Reals[size]) for k, size in zip("xyz", event_sizes)
      )
  
      f = mvn_to_funsor(mvn, tuple(int_inputs), real_inputs)
      assert isinstance(f, Funsor)
      for k, d in int_inputs.items():
          if d.num_elements == 1:
              assert d not in f.inputs
          else:
              assert k in f.inputs
              assert f.inputs[k] == d
      for k, d in real_inputs.items():
          assert k in f.inputs
          assert f.inputs[k] == d
  
      value = mvn.sample()
      subs = {}
      beg = 0
      for k, d in real_inputs.items():
          end = beg + d.num_elements
          subs[k] = tensor_to_funsor(
              value[..., beg:end], tuple(int_inputs), 1
          )
          beg = end
      actual_log_prob = f(**subs)
      expected_log_prob = tensor_to_funsor(
          mvn.log_prob(value), tuple(int_inputs)
      )
      assert_close(
          actual_log_prob, expected_log_prob, atol=1e-5, rtol=1e-5
      )
  
imports: from collections import OrderedDict
  import pyro.distributions
  import pytest
  import torch
  from pyro.distributions.torch_distribution import MaskedDistribution
  from funsor.domains import Bint, Reals
  from funsor.pyro.convert import dist_to_funsor, funsor_to_cat_and_mvn, funsor_to_mvn, funsor_to_tensor, matrix_and_mvn_to_funsor, mvn_to_funsor, tensor_to_funsor
  from funsor.tensor import Tensor
  from funsor.terms import Funsor
  from funsor.testing import assert_close, random_mvn
label_desc: Use image node_id 2 for calling a global function with example usage: test_mvn_to_funsor(batch_shape, event_shape, event_sizes) without return types