code: def add_all_database_reactions(model, compartments):
      
  
      added = set()
      for rxnid in model.database.reactions:
          reaction = model.database.get_reaction(rxnid)
          if all(compound.compartment in compartments
                 for compound, _ in reaction.compounds):
              if not model.has_reaction(rxnid):
                  added.add(rxnid)
              model.add_reaction(rxnid)
  
      return added
docs: Add all reactions from database that occur in given compartments.
  
      Args:
          model: :class:`psamm.metabolicmodel.MetabolicModel`.