def METHOD_NAME(self, obj):
    if isinstance(obj, Decimal):
        return int(obj.to_integral_value())
    # for most data types, this function isn't called.
    # the following is added for safety, but should not
    # be required.
    return json.JSONEncoder.METHOD_NAME(self, obj)  # pragma nocover