Sometimes the more complex problems have the simplest solutions.
You are the programmer you know all the possible items the user can have.
Just hard code an array with all the possible items as strings in alphabetical order
Then just refer to it with a double for for loop.
First loop checking all the possible items, second loop searching the players items. In this case the button name
If theres a match append a temperary array/ dictionary depending on use case
Then assign the temporary variable as the new list after its complete.
Better yet just use a single loop over the array of all the possible items from the alphabetical array then use the has() function on your player items dictionary then do it that way