def default(value):
if isinstance(value, Decimal):<EOL><INDENT>primative = float(value)<EOL>if int(primative) == primative:<EOL><INDENT>return int(primative)<EOL><DEDENT>else:<EOL><INDENT>return primative<EOL><DEDENT><DEDENT>elif isinstance(value, set):<EOL><INDENT>return list(value)<EOL><DEDENT>elif isinstance(value, Binary):<EOL><INDENT>return b64encode(value.value)<EOL><DEDENT>raise TypeError("<STR_LIT>" % (type(value), value))<EOL>
Default encoder for JSON