code: def normalize_integrate_contraction(
      log_measure, integrand, reduced_vars
  ):
      reduced_names = frozenset(v.name for v in reduced_vars)
      delta_terms = [
          t
          for t in log_measure.terms
          if isinstance(t, Delta)
          and t.fresh.intersection(reduced_names, integrand.inputs)
      ]
      for delta in delta_terms:
          delta_fresh = frozenset(
              Variable(k, delta.inputs[k]) for k in delta.fresh
          )
          args = delta, integrand, delta_fresh
          integrand = eager.dispatch(Integrate, *args)(*args)
      return normalize_integrate(log_measure, integrand, reduced_vars)
  
imports: from collections import OrderedDict
  from functools import reduce
  from typing import Tuple, Union
  import funsor.ops
  from funsor.cnf import Contraction, GaussianMixture
  from funsor.constant import Constant
  from funsor.delta import Delta
  from funsor.gaussian import Gaussian, _norm2, _vm, align_gaussian
  from funsor.interpretations import eager, normalize
  from funsor.tensor import Tensor
  from funsor.terms import Funsor, FunsorMeta, Number, Subs, Unary, Variable, _convert_reduced_vars, substitute, to_funsor
label_desc: Use image node_id 2 for calling a global function with example usage: normalize_integrate_contraction(log_measure, integrand, reduced_vars) and returns: normalize_integrate