let pop_with_key t =
    try Some (pop_with_key_exn t)
    with Heap.Empty -> None