Blender 3.2 how to find unselectable ob

Like this?

import bpy

SELECTABLE_OBJECTS = []
ALL_OBJECTS = []
SELECTED_OBJECTS = []

def find_if_selectable():

    # Get all unselected objects
    for c1 in bpy.data.collections:
        for o1 in c1.all_objects:
            if o1.hide_select:
                SELECTABLE_OBJECTS.append(o1)
       
    # Remove duplicate strings, then output final list names
    d1 = [*set(SELECTABLE_OBJECTS)]
    for a1 in d1:
        print("Unselectable object: " + a1.name)
                
def find_all_selectable():

    # Get all scene objects + selected objects in Outliner
    for w in bpy.context.window_manager.windows:
        for a in w.screen.areas:
            if a.type == "OUTLINER":
                with bpy.context.temp_override(window=w, area=a):
                    for c2 in bpy.data.collections:
                        for o2 in c2.all_objects:
                            ALL_OBJECTS.append(o2)
                    for item in bpy.context.selected_ids:
                        if item.bl_rna.identifier == "Object":
                            SELECTED_OBJECTS.append(bpy.data.objects[str(item.name)])

    # Remove duplicate strings, then output final list names
    d2 = [*set(ALL_OBJECTS)]
    for a2 in d2:
        if a2 not in SELECTED_OBJECTS:
            print("Unselected object: " + a2.name)
    
find_if_selectable()
find_all_selectable()