Python Multiset Implementation Solution