Python's groupby function

In Python, itertools.groupby is a convenient function for grouping together consecutive elements from an iterable which share some property.