def sort_mapping_by_size(cluster_mapping):
 return sorted(cluster_mapping.keys(), cmp=(lambda a, b: cmp(len(a), len(b))), key=(lambda k: cluster_mapping[k]), reverse=True)

def sort_mapping_by_size ( cluster_mapping ) : return sorted ( cluster_mapping . keys ( ) , cmp = ( lambda a , b : cmp ( len ( a ) , len ( b ) ) ) , key = ( lambda k : cluster_mapping [ k ] ) , reverse = True )
sort the keys of a dict reative to their values length cluster_mapping: dict with mapping as list of ids .