In Python, the heapq module provides a priority queue.
It has methods for inserting and popping items.
How do you remove an item that you have inserted that is not the lowest priority from the queue?
(Alternative recipes for doing this using alternative other collections are welcome too)