def _sort_commands(cmddict, order):
    def keyfn(key):
        try:
            return order.index(key[1])
        except __HOLE__:
            # unordered items should come last
            return 0xff

    return sorted(cmddict.items(), key=keyfn)
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/commands/__init__.py/_sort_commands