<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

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