code: def normalize_contraction_commutative_canonical_order(
      red_op, bin_op, reduced_vars, *terms
  ):
      # when bin_op is commutative, put terms into a canonical order for pattern matching
      new_terms = tuple(
          v
          for i, v in sorted(
              enumerate(terms),
              key=lambda t: (
                  ORDERING.get(type(t[1]).__origin__, -1),
                  t[0],
              ),
          )
      )
      if any(v is not vv for v, vv in zip(terms, new_terms)):
          return Contraction(red_op, bin_op, reduced_vars, *new_terms)
      return normalize.interpret(
          Contraction, red_op, bin_op, reduced_vars, new_terms
      )
  
imports: import functools
  import itertools
  from collections import Counter, OrderedDict, defaultdict
  from functools import reduce
  from typing import Tuple, Union
  import opt_einsum
  import funsor
  import funsor.ops
  from funsor.affine import affine_inputs
  from funsor.delta import Delta
  from funsor.domains import find_domain
  from funsor.gaussian import Gaussian
  from funsor.interpretations import eager, normalize, reflect
  from funsor.interpreter import children
  from funsor.ops import DISTRIBUTIVE_OPS, AssociativeOp, NullOp
  from funsor.tensor import Tensor
  from funsor.terms import _INFIX, Align, Binary, Funsor, Number, Reduce, Subs, Unary, Variable, to_funsor
  from funsor.typing import Variadic
  from funsor.util import broadcast_shape, get_backend, quote
label_desc: Use image node_id 13 for calling a global function with example usage: normalize_contraction_commutative_canonical_order(red_op, bin_op, reduced_vars) and returns: normalize, Contraction