A Python module that implements the heap queue algorithm. Use only when the question is specific to this heap implementation, as opposed to heap mechanics in general.
Module documentation: heapq
Alternative, using a different interface: queue.PriorityQueue
See also the language-agnostic heap tag.