import decimal


def dec_encode(o):
    """
    Decimal encoder for JSON

    This converts Decimal into floats, as DynamoDB returns Decimal numbers.
    """
    if isinstance(o, decimal.Decimal):
        return float(o)
    raise TypeError(repr(o) + " is not JSON serializable")