def reduce(self, pos, newitem):
        "Replace self[pos] with a lower value item and then reheapify"
        while pos > 0:
            parentpos = (pos - 1) >> 1
            parent = self[parentpos]
            if parent <= newitem:
                break
            self[pos] = parent
            pos = parentpos
        self[pos] = newitem
Replace self[pos] with a lower value item and then reheapify
recipes/Python/437116_Wrapper_class_heapq/recipe-437116.py