def final_touches(s2, r, deg_g):
 R = s2.row((r - 1))
 for i in range(s2.cols):
  if (R[(0, i)] == 0):
   continue
  else:
   break
 mr = (s2.cols - ((i + deg_g) + 1))
 i = 0
 while ((mr != 0) and ((r + i) < s2.rows)):
  s2[(r + i), :] = rotate_r(R, (i + 1))
  i += 1
  mr -= 1
 return s2

def final_touches ( s2 , r , deg_g ) : R = s2 . row ( ( r - 1 ) ) for i in range ( s2 . cols ) : if ( R [ ( 0 , i ) ] == 0 ) : continue else : break mr = ( s2 . cols - ( ( i + deg_g ) + 1 ) ) i = 0 while ( ( mr != 0 ) and ( ( r + i ) < s2 . rows ) ) : s2 [ ( r + i ) , : ] = rotate_r ( R , ( i + 1 ) ) i += 1 mr -= 1 return s2
s2 is sylvester2 .