code: def _swap(f, i):
      """
      Make the variable `x_i` the leading one in a multivariate polynomial `f`.
      """
      ring = f.ring
      fswap = ring.zero
      for monom, coeff in f.iterterms():
          monomswap = (monom[i],) + monom[:i] + monom[i + 1 :]
          fswap[monomswap] = coeff
      return fswap
  
imports: from sympy.core.symbol import Dummy
  from sympy.ntheory import nextprime
  from sympy.ntheory.modular import crt
  from sympy.polys.domains import PolynomialRing
  from sympy.polys.galoistools import gf_gcd, gf_from_dict, gf_gcdex, gf_div, gf_lcm
  from sympy.polys.polyerrors import ModularGCDFailed
  from mpmath import sqrt
  import random
label_desc: Use image node_id 9 for calling a global function with example usage: _swap(f, i) and returns: fswap