def get_party_results_deltas(election, years, parties):
    """ Returns the aggregated party results with the differences to the
    last elections.

    """
    deltas = len(years) > 1
    results = {}
    for index, year in enumerate(years):
        results[year] = []
        for key in sorted(parties.keys()):
            result = [key]
            party = parties[key]
            values = party.get(year)
            if values:
                result.append(values.get('mandates', ''))
                result.append(values.get('votes', {}).get('total', ''))
                permille = values.get('votes', {}).get('permille')
                result.append('{}%'.format(permille / 10 if permille else ''))
            else:
                result.append('')
                result.append('')
                result.append('')
            if deltas:
                delta = ''
                if index:
                    last = party.get(years[index - 1])
                    if values and last:
                        diff = ((values.get('votes', {}).get('permille', 0) or
                            0) - (last.get('votes', {}).get('permille', 0) or
                            0)) / 10
                        delta = '{}%'.format(diff)
                result.append(delta)
            results[year].append(result)
    return deltas, results
