def sort_clustering_results(c_results):
    def compare_func(a, b):
        if a[1]["type"] == b[1]["type"]:
            if a[1]["parameters"] in "k":
                return a[1]["parameters"]["k"] - b[1]["parameters"]["k"]
            return 0
        else:
            return cmp(a[1]["type"], b[1]["type"])
    return sorted([(cid, c_results[cid]) for cid in c_results] , key=cmp_to_key(compare_func))
dataset/ETHPy150Open victor-gil-sepulveda/pyProCT/pyproct/driver/results/clusteringResultsGatherer.py/sort_clustering_results/swapped operands of `in`