use itertools to short circuit has_same_contents on no match