def to_json_compatible(record):
d = {}<EOL>for fname, f in record._fields.iteritems():<EOL><INDENT>val = getattr(record, fname)<EOL>if val is not None:<EOL><INDENT>d[fname] = f.dump(val)<EOL><DEDENT><DEDENT>return d<EOL>
Dump record in json-encodable object format