I want to group a list of objects based on an attribute which is a list. The problem is here that itertools.groupby function only groups sorted lists and I