@classmethod
    def toggle_attributes(cls, attribute_name):
        objs = pm.ls(sl=1)
        new_list = []

        attribute_count = 0
        set_to_state = 1

        for obj in objs:
            if obj.hasAttr(attribute_name):
                if obj.getAttr(attribute_name):
                    attribute_count += 1
                new_list.append(obj)

        obj_count = len(new_list)

        if attribute_count == obj_count:
            set_to_state = 0

        for obj in new_list:
            obj.setAttr(attribute_name, set_to_state)
toggles the given attribute for the given list of objects
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/toolbox.py/General.toggle_attributes