#NEWLINE# def ring_new( self , element ) : #NEWLINE# #INDENT# if isinstance ( element , PolyElement ) : #NEWLINE# #INDENT# if ( self == element . ring ) : #NEWLINE# #INDENT# return element #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( self . domain , PolynomialRing ) and ( self . domain . ring == element . ring ) ) : #NEWLINE# #INDENT# return self . ground_new ( element ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NotImplementedError ( 'conversion' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( element , string_types ) : #NEWLINE# #INDENT# raise NotImplementedError ( 'parsing' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( element , dict ) : #NEWLINE# #INDENT# return self . from_dict ( element ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( self , list ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return self . from_terms ( element ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return self . from_list ( element ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( element , Expr ) : #NEWLINE# #INDENT# return self . from_expr ( element ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . ground_new ( element )