def _get_species_taxon_ids(taxdump_file,<EOL>select_divisions=None, exclude_divisions=None):
if select_divisions and exclude_divisions:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>select_division_ids = None<EOL>exclude_division_ids = None<EOL>divisions = None<EOL>if select_divisions or exclude_divisions:<EOL><INDENT>divisions = _get_divisions(taxdump_file)<EOL><DEDENT>if select_divisions:<EOL><INDENT>select_division_ids = set([divisions[d] for d in select_divisions])<EOL><DEDENT>elif exclude_divisions:<EOL><INDENT>exclude_division_ids = set([divisions[d] for d in exclude_divisions])<EOL><DEDENT>with tarfile.open(taxdump_file) as tf:    <EOL><INDENT>with tf.extractfile('<STR_LIT>') as fh:<EOL><INDENT>df = pd.read_csv(fh, header=None, sep='<STR_LIT:|>', encoding='<STR_LIT:ascii>')<EOL><DEDENT><DEDENT>df = df.iloc[:, [<NUM_LIT:0>, <NUM_LIT:2>, <NUM_LIT:4>]]<EOL>if select_division_ids:<EOL><INDENT>df = df.loc[df.iloc[:, <NUM_LIT:2>].isin(select_division_ids)]<EOL><DEDENT>elif exclude_division_ids:<EOL><INDENT>df = df.loc[~df.iloc[:, <NUM_LIT:2>].isin(exclude_division_ids)]<EOL><DEDENT>df.iloc[:, <NUM_LIT:1>] = df.iloc[:, <NUM_LIT:1>].str.strip('<STR_LIT:\t>')<EOL>taxon_ids = df.iloc[:, <NUM_LIT:0>].loc[df.iloc[:, <NUM_LIT:1>] == '<STR_LIT>'].values<EOL>return taxon_ids<EOL>
Get a list of species taxon IDs (allow filtering by division).