def _precord_model(klass):
 further_classes = set()
 if issubclass(klass, PRecord):
  attr_name = '_precord_fields'
 else:
  attr_name = '_pclass_fields'
 record = {u'category': u'record', u'fields': {}}
 for (name, field_info) in getattr(klass, attr_name).items():
  record[u'fields'][name] = sorted((fqpn(cls) for cls in field_info.type))
  for cls in field_info.type:
   further_classes.add(cls)
 return (record, further_classes)

def _precord_model ( klass ) : further_classes = set ( ) if issubclass ( klass , PRecord ) : attr_name = '_precord_fields' else : attr_name = '_pclass_fields' record = { u'category' : u'record' , u'fields' : { } } for ( name , field_info ) in getattr ( klass , attr_name ) . items ( ) : record [ u'fields' ] [ name ] = sorted ( ( fqpn ( cls ) for cls in field_info . type ) ) for cls in field_info . type : further_classes . add ( cls ) return ( record , further_classes )
serialize a precord or pclass model to something json-encodable .