def merge_like_ops(self):
cigs = []<EOL>for op, grps in groupby(self.items(), itemgetter(<NUM_LIT:1>)):<EOL><INDENT>cigs.append((sum(g[<NUM_LIT:0>] for g in grps), op))<EOL><DEDENT>return Cigar(self.string_from_elements(cigs))<EOL>
>>> Cigar("1S20M").merge_like_ops()
Cigar('1S20M')
>>> Cigar("1S1S20M").merge_like_ops()
Cigar('2S20M')
>>> Cigar("1S1S1S20M").merge_like_ops()
Cigar('3S20M')
>>> Cigar("1S1S1S20M1S1S").merge_like_ops()
Cigar('3S20M2S')