def find_degree(M, deg_f):
 j = deg_f
 for i in range(0, M.cols):
  if (M[((M.rows - 1), i)] == 0):
   j = (j - 1)
  else:
   return (j if (j >= 0) else 0)

def find_degree ( M , deg_f ) : j = deg_f for i in range ( 0 , M . cols ) : if ( M [ ( ( M . rows - 1 ) , i ) ] == 0 ) : j = ( j - 1 ) else : return ( j if ( j >= 0 ) else 0 )
finds the degree of the poly corresponding to the _last_ row of the small matrix m .