def pick_monomials_up_to_degree(monomials, degree):
ordered_monomials = []<EOL>if degree >= <NUM_LIT:0>:<EOL><INDENT>ordered_monomials.append(S.One)<EOL><DEDENT>for deg in range(<NUM_LIT:1>, degree + <NUM_LIT:1>):<EOL><INDENT>ordered_monomials.extend(pick_monomials_of_degree(monomials, deg))<EOL><DEDENT>return ordered_monomials<EOL>
Collect monomials up to a given degree.