def sort_data(data, key):
    """
    Sort a list of dicts by a given key

    :param data: input list of dicts
    :param key: key to sort
    :return: sorted list of dicts
    """
    assert any(data)
    return sorted(data, key=lambda k: k[key])