Reference solution
The shape we check against. Any implementation that passes the assertions is valid — this one favours clarity.
def dedupe(items):
seen = set()
out = []
for x in items:
if x not in seen:
seen.add(x)
out.append(x)
return out