@medium.setter<EOL><INDENT>def medium(self, medium):<DEDENT>
def set_active_bound(reaction, bound):<EOL><INDENT>if reaction.reactants:<EOL><INDENT>reaction.lower_bound = -bound<EOL><DEDENT>elif reaction.products:<EOL><INDENT>reaction.upper_bound = bound<EOL><DEDENT><DEDENT>media_rxns = list()<EOL>exchange_rxns = frozenset(self.exchanges)<EOL>for rxn_id, bound in iteritems(medium):<EOL><INDENT>rxn = self.reactions.get_by_id(rxn_id)<EOL>if rxn not in exchange_rxns:<EOL><INDENT>LOGGER.warn("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>rxn.id)<EOL><DEDENT>media_rxns.append(rxn)<EOL>set_active_bound(rxn, bound)<EOL><DEDENT>media_rxns = frozenset(media_rxns)<EOL>for rxn in (exchange_rxns - media_rxns):<EOL><INDENT>set_active_bound(rxn, <NUM_LIT:0>)<EOL><DEDENT>
Get or set the constraints on the model exchanges.

        `model.medium` returns a dictionary of the bounds for each of the
        boundary reactions, in the form of `{rxn_id: bound}`, where `bound`
        specifies the absolute value of the bound in direction of metabolite
        creation (i.e., lower_bound for `met <--`, upper_bound for `met -->`)

        Parameters
        ----------
        medium: dictionary-like
            The medium to initialize. medium should be a dictionary defining
            `{rxn_id: bound}` pairs.