<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def default(value):
 """ Default encoder for JSON """

    if isinstance(value, Decimal):
        primative = float(value)
        if int(primative) == primative:
            return int(primative)
        else:
            return primative
    elif isinstance(value, set):
        return list(value)
    elif isinstance(value, Binary):
        return b64encode(value.value)
    raise TypeError("Cannot encode %s value %r" % (type(value), value))