def serialize_struct_type(struct_type, accessor, types):
 fields = []
 if (struct_type == dereference_type(struct_type)):
  memeber_operator = '.'
 else:
  memeber_operator = '->'
 structure = type_description(struct_type, types)['struct']
 for (field_name, field_type) in structure.iteritems():
  fields.append(serialize_type(field_type, ((('((%s)(%s))' % (struct_type, accessor)) + memeber_operator) + field_name), types))
 return ', '.join(fields)

def serialize_struct_type ( struct_type , accessor , types ) : fields = [ ] if ( struct_type == dereference_type ( struct_type ) ) : memeber_operator = '.' else : memeber_operator = '->' structure = type_description ( struct_type , types ) [ 'struct' ] for ( field_name , field_type ) in structure . iteritems ( ) : fields . append ( serialize_type ( field_type , ( ( ( '((%s)(%s))' % ( struct_type , accessor ) ) + memeber_operator ) + field_name ) , types ) ) return ', ' . join ( fields )
returns a serialization statement for the given structure type .