def sort_dict(self, data, key):
    '''Sort a list of dictionaries by dictionary key'''
    return sorted(data, key=itemgetter(key)) if data else []
def sort_dict ( self , data , key ) : return sorted ( data , key = itemgetter ( key ) ) if data else [ ]
Sort a list of dictionaries by dictionary key