Python: sort an array of dictionaries with custom comparator?,key = lambda d: d['rank'] if d['rank'] != 0 else float('inf')