code: def spoly(p1, p2, ring):
      """
      Compute LCM(LM(p1), LM(p2))/LM(p1)*p1 - LCM(LM(p1), LM(p2))/LM(p2)*p2
      This is the S-poly provided p1 and p2 are monic
      """
      LM1 = p1.LM
      LM2 = p2.LM
      LCM12 = ring.monomial_lcm(LM1, LM2)
      m1 = ring.monomial_div(LCM12, LM1)
      m2 = ring.monomial_div(LCM12, LM2)
      s1 = p1.mul_monom(m1)
      s2 = p2.mul_monom(m2)
      s = s1 - s2
      return s
  
imports: from sympy.core.symbol import Dummy
  from sympy.polys.monomials import monomial_mul, monomial_lcm, monomial_divides, term_div
  from sympy.polys.orderings import lex
  from sympy.polys.polyerrors import DomainError
  from sympy.polys.polyconfig import query
label_desc: Use image node_id 3 for calling a global function with example usage: spoly(p1, p2, ring) and returns: s