code: def _simplify_delta(expr):
      """
      Rewrite a KroneckerDelta's indices in its simplest form.
      """
      if isinstance(expr, KroneckerDelta):
          try:
              slns = solve(expr.args[0] - expr.args[1], dict=True)
              if slns and len(slns) == 1:
                  return Mul(
                      *[
                          KroneckerDelta(*(key, value))
                          for key, value in slns[0].items()
                      ]
                  )
          except NotImplementedError:
              pass
      return expr
  
file_path: sympy/sympy/concrete/delta.py
imports: from .products import product
  from .summations import Sum, summation
  from sympy.core import Add, Mul, S, Dummy
  from sympy.core.cache import cacheit
  from sympy.core.sorting import default_sort_key
  from sympy.functions import KroneckerDelta, Piecewise, piecewise_fold
  from sympy.polys.polytools import factor
  from sympy.sets.sets import Interval
  from sympy.solvers.solvers import solve
label_desc: Use image node_id 6 for calling a global function with example usage: _simplify_delta(expr) and returns: expr, Mul