Factor out multiple top-n implementations into reuseable adaptor
And replace its implementation by itertools' k-smallest algorithm which also uses a heap internally but saves us the trouble after having adapted our key-value items.
And replace its implementation by itertools' k-smallest algorithm which also uses a heap internally but saves us the trouble after having adapted our key-value items.