def partitionby(func, seq):
 return map(tuple, pluck(1, itertools.groupby(seq, key=func)))

def partitionby ( func , seq ) : return map ( tuple , pluck ( 1 , itertools . groupby ( seq , key = func ) ) )
partition a sequence according to a function partition s into a sequence of lists such that .