diff --git a/moto/elb/responses.py b/moto/elb/responses.py index 6f1c4a8c6..0426909be 100644 --- a/moto/elb/responses.py +++ b/moto/elb/responses.py @@ -241,8 +241,11 @@ class ELBResponse(BaseResponse): elif t_key.split('.')[3] == 'Value': tag_values.extend(t_val) - counts = sorted({i:tag_keys.count(i) for i in tag_keys}.items(), - key=lambda i:i[1], reverse=True) + counts = {} + for i in tag_keys: + counts[i] = tag_keys.count(i) + + counts = sorted(counts.items(), key=lambda i:i[1], reverse=True) if counts and counts[0][1] > 1: # We have dupes...