I have a list of objects in python, and a compare function that, given two objects, decides whether they should be considered equal.

I want to convert the list of objects to a new list of lists, where each sublist gathers elements that compare equal.

What's a pythonic way to do this?