import bpy

class MegaDecimate(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.mega_decimate"
    bl_label = "Mega Decimate"

    def execute(self, context):
        selection = bpy.context.selected_objects

        for obj in selection:
            if not obj.type == 'MESH':
                continue
            
            bpy.context.view_layer.objects.active = obj
            bpy.ops.mesh.customdata_custom_splitnormals_clear()
            bpy.context.object.data.use_auto_smooth = True
            bpy.ops.object.modifier_add(type='DECIMATE')
            bpy.ops.object.modifier_add(type='WEIGHTED_NORMAL')
            bpy.context.object.modifiers["Weighted Normal"].keep_sharp = True
            
        return {'FINISHED'}

def register():
    bpy.utils.register_class(MegaDecimate)

def unregister():
    bpy.utils.unregister_class(MegaDecimate)

if __name__ == "__main__":
    register()