def add_all_database_reactions(model, compartments):
added = set()<EOL>for rxnid in model.database.reactions:<EOL><INDENT>reaction = model.database.get_reaction(rxnid)<EOL>if all(compound.compartment in compartments<EOL>for compound, _ in reaction.compounds):<EOL><INDENT>if not model.has_reaction(rxnid):<EOL><INDENT>added.add(rxnid)<EOL><DEDENT>model.add_reaction(rxnid)<EOL><DEDENT><DEDENT>return added<EOL>
Add all reactions from database that occur in given compartments.

    Args:
        model: :class:`psamm.metabolicmodel.MetabolicModel`.