code: def symmetric_residue(a, m):
      """Return the residual mod m such that it is within half of the modulus.
  
      >>> from sympy.ntheory.modular import symmetric_residue
      >>> symmetric_residue(1, 6)
      1
      >>> symmetric_residue(4, 6)
      -2
      """
      if a <= m // 2:
          return a
      return a - m
  
file_path: sympy/sympy/ntheory/modular.py
imports: from math import prod
  from sympy.external.gmpy import gcd, gcdext
  from sympy.ntheory.primetest import isprime
  from sympy.polys.domains import ZZ
  from sympy.polys.galoistools import gf_crt, gf_crt1, gf_crt2
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 1 for calling a global function with example usage: symmetric_residue(a, m) and returns: unknown, a