def add_SBO(model):
for r in model.reactions:<EOL><INDENT>if r.annotation.get("<STR_LIT>"):<EOL><INDENT>continue<EOL><DEDENT>if len(r.metabolites) != <NUM_LIT:1>:<EOL><INDENT>continue<EOL><DEDENT>met_id = list(r._metabolites)[<NUM_LIT:0>].id<EOL>if r.id.startswith("<STR_LIT>") and r.id == "<STR_LIT>" + met_id:<EOL><INDENT>r.annotation["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>elif r.id.startswith("<STR_LIT>") and r.id == "<STR_LIT>" + met_id:<EOL><INDENT>r.annotation["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT><DEDENT>
adds SBO terms for demands and exchanges

    This works for models which follow the standard convention for
    constructing and naming these reactions.

    The reaction should only contain the single metabolite being exchanged,
    and the id should be EX_metid or DM_metid