code: def final_touches(s2, r, deg_g):
      """
      s2 is sylvester2, r is the row pointer in s2,
      deg_g is the degree of the poly last inserted in s2.
  
      After a gcd of degree > 0 has been found with Van Vleck's
      method, and was inserted into s2, if its last term is not
      in the last column of s2, then it is inserted as many
      times as needed, rotated right by one each time, until
      the condition is met.
  
      """
      R = s2.row(r - 1)
  
      # find the first non zero term
      for i in range(s2.cols):
          if R[0, i] == 0:
              continue
          else:
              break
  
      # missing rows until last term is in last column
      mr = s2.cols - (i + deg_g + 1)
  
      # insert them by replacing the existing entries in the row
      i = 0
      while mr != 0 and r + i < s2.rows:
          s2[r + i, :] = rotate_r(R, i + 1)
          i += 1
          mr -= 1
  
      return s2
  
imports: from sympy.concrete.summations import summation
  from sympy.core.function import expand
  from sympy.core.numbers import nan
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy
  from sympy.functions.elementary.complexes import Abs, sign
  from sympy.functions.elementary.integers import floor
  from sympy.matrices.dense import eye, Matrix, zeros
  from sympy.printing.pretty.pretty import pretty_print
  from sympy.simplify.simplify import simplify
  from sympy.polys.domains import QQ
  from sympy.polys.polytools import degree, LC, Poly, pquo, quo, prem, rem
  from sympy.polys.polyerrors import PolynomialError
label_desc: Use image node_id 35 for calling a global function with example usage: final_touches(s2, r, deg_g) and returns: s2