import operator
from operator import itemgetter
import pprint
l = [{'firstname': 'joe', 'surname': 'bloggs'}, {'firstname': 'john',
    'surname': 'smith'}, {'firstname': 'joe', 'surname': 'bloggs'}, {
    'firstname': 'jane', 'surname': 'bloggs'}]
getvals = operator.itemgetter('firstname', 'surname')
l.sort(key=getvals)
result = []
for k, g in itertools.groupby(l, getvals):
    result.append(next(g))
l[:] = result
pprint.pprint(l)
python удалить дубликаты словарей из списка