Setting Slots None selectively from a custom action

I know that for setting slots we use-
return [SlotSet(“slot”, value)].

Now my requirement is -
Suppose i have 5 slots - s1 , s2 , s3 , s4 , s5.
i am inside a custom action and i want to null all slots except s2.

I dont want to write this explicitly -
return [SlotSet(“s1”, None) , SlotSet(“s3”, None) , SlotSet(“s4”, None), SlotSet(“s5”, None)]

How can i do this
kindly help .

Hi Vivek, you could do something like:

    slots = []

    for key in tracker.slots.keys():
        if key != "s2":
            slots.append(SlotSet(key=key, value=None))

    return slots

Thanks for the solution

I also got the solution when i check source file of SlotSet in