def _heappushpop_max(heap, item):
 if (heap and cmp_lt(item, heap[0])):
  (item, heap[0]) = (heap[0], item)
  _siftup_max(heap, 0)
 return item

def _heappushpop_max ( heap , item ) : if ( heap and cmp_lt ( item , heap [ 0 ] ) ) : ( item , heap [ 0 ] ) = ( heap [ 0 ] , item ) _siftup_max ( heap , 0 ) return item
maxheap version of a heappush followed by a heappop .