I come across this Answer utilizing a dictionary somewhat elegant, strong and pythonic. Early optimisations are evil in any case so let's have a dict and see later on it it is a bottleneck.It is possible to then test In case the list is vacant and, in the event that It isn't vacant, extract The one component with the returned list.Typically you nee