extension to Python standard library heapq package