def encode(self, obj, *args, **kwargs):
        if isinstance(obj, dict):
            new_obj = type(obj)()
            for key, value in six.iteritems(obj):
                if is_lazy_string(key):
                    try:
                        key = unicode(key)
                    except __HOLE__:
                        key = str(key)
                new_obj[key] = value
            obj = new_obj 
        return super(JSONEncoder, self).encode(obj, *args, **kwargs)
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/web/app.py/CustomJSONEncoder.encode