def GetItemsForSlot(item_list, slot):
    return [(k, v) for k, v in list(item_list.items()) if v['slot'] == slot]

def SubtractWeights(current_weights, item_weights):
    remaining_weights = {}
for k, v in list(current_weights.items()):
    remaining_weights[k] = current_weights[k] - item_weights[k]
return remaining_weights

def AllWeightsAreZero(remaining_weights):
    return not [v for v in list(remaining_weights.values()) if v != 0]
Скрипт Python для вычисления добавленных комбинаций из словаря