#NEWLINE# def __sum_group_by_first( self , list_of_pairs ) : #NEWLINE# #INDENT# return [ ( x , sum ( [ z [ 1 ] for z in y ] ) ) for ( x , y ) in groupby ( sorted ( list_of_pairs , key = operator . itemgetter ( 0 ) ) , key = operator . itemgetter ( 0 ) ) ]