#NEWLINE# def write_struct( self , obj ) : #NEWLINE# #INDENT# self . write_struct_begin ( ) #NEWLINE# for field in obj . thrift_spec : #NEWLINE# #INDENT# if ( field is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# fspec = obj . thrift_spec [ ftype ] #NEWLINE# if ( len ( fspec ) == 3 ) : #NEWLINE# #INDENT# ( ftype , fname , freq ) = fspec #NEWLINE# f_container_spec = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( ftype , fname , f_container_spec , f_req ) = fspec #NEWLINE# #UNINDENT# val = getattr ( obj , fname ) #NEWLINE# if ( val is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# self . write_field_begin ( fname , ftype , field ) #NEWLINE# self . write_val ( ftype , val , f_container_spec ) #NEWLINE# self . write_field_end ( ) #NEWLINE# #UNINDENT# self . write_field_stop ( ) #NEWLINE# self . write_struct_end ( )