code: def handle_sum_or_prod(func, name):
      val = convert_mp(func.mp())
      iter_var = convert_expr(func.subeq().equality().expr(0))
      start = convert_expr(func.subeq().equality().expr(1))
      if func.supexpr().expr():  # ^{expr}
          end = convert_expr(func.supexpr().expr())
      else:  # ^atom
          end = convert_atom(func.supexpr().atom())
  
      if name == "summation":
          return sympy.Sum(val, (iter_var, start, end))
      elif name == "product":
          return sympy.Product(val, (iter_var, start, end))
  
imports: from importlib.metadata import version
  import sympy
  from sympy.external import import_module
  from sympy.printing.str import StrPrinter
  from sympy.physics.quantum.state import Bra, Ket
  from .errors import LaTeXParsingError
label_desc: Use image node_id 21 for calling a global function with example usage: handle_sum_or_prod(func, name) and returns: sympy, sympy