def _group(self, taxslice):
res = []<EOL>while taxslice:<EOL><INDENT>taxref, lident = taxslice.pop()<EOL>if lident == '<STR_LIT>':<EOL><INDENT>res.append(([taxref], lident))<EOL><DEDENT>else:<EOL><INDENT>i = <NUM_LIT:0><EOL>group = []<EOL>while i < len(taxslice):<EOL><INDENT>if taxslice[i][<NUM_LIT:1>] == lident:<EOL><INDENT>group.append(taxslice.pop(i)[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>i += <NUM_LIT:1><EOL><DEDENT><DEDENT>group.append(taxref)<EOL>res.append((group, lident))<EOL><DEDENT><DEDENT>return res<EOL>
Return list of lists of idents grouped by shared rank