def default(self, obj):
    replacer = self.__type_replacements.get(type(obj), None)
    if replacer:
        obj = replacer(obj)
    if isinstance(obj, set):
        return tuple(obj)
    if isinstance(obj, uuid.UUID):
        return str(obj)
    if isinstance(obj, (datetime.datetime, datetime.date)):
        return obj.isoformat()
    if isinstance(obj, decimal.Decimal):
        return str(obj)
    if isinstance(obj, array.array):
        if (obj.typecode == 'c'):
            return obj.tostring()
        if (obj.typecode == 'u'):
            return obj.tounicode()
        return obj.tolist()
    return self.class_to_dict(obj)
def default(self, obj):
    replacer = self.__type_replacements.get(type(obj), None)
    if replacer:
        obj = replacer(obj)
    if isinstance(obj, set):
        return tuple(obj)
    if isinstance(obj, uuid.UUID):
        return str(obj)
    if isinstance(obj, (datetime.datetime, datetime.date)):
        return obj.isoformat()
    if isinstance(obj, decimal.Decimal):
        return str(obj)
    if isinstance(obj, array.array):
        if (obj.typecode == 'c'):
            return obj.tostring()
        if (obj.typecode == 'u'):
            return obj.tounicode()
        return obj.tolist()
    return self.class_to_dict(obj)