I have list1
list1 = ["a", "a", "b", "c", "d"]
I have another list2
list2 = ["a", "d"]
I want the output as follows
out = ["a", "a", "d"]
I am doing following
> l1 = set(list1)
>>> l2 = set(list2)
>>> l1.intersection(l2)
But I am loosing duplicates of list1 here. The lists are in actual pretty big. Can't run loop. I need to use some fast efficient way only.