#NEWLINE# def expr_from_dict( rep , * gens ) : #NEWLINE# #INDENT# 'Convert a multinomial form into an expression. ' #NEWLINE# result = [ ] #NEWLINE# for ( monom , coeff ) in rep . items ( ) : #NEWLINE# #INDENT# term = [ coeff ] #NEWLINE# for ( g , m ) in zip ( g , monom ) : #NEWLINE# #INDENT# if m : #NEWLINE# #INDENT# term . append ( Pow ( g , m ) ) #NEWLINE# #UNINDENT# #UNINDENT# result . append ( Mul ( * term ) ) #NEWLINE# #UNINDENT# return Add ( * result )