python: sort an array of dictionaries with custom comparator?,"key = lambda d: d.get('rank', float('inf'))"