def remove_reactions(self, reactions, remove_orphans=False):
if isinstance(reactions, string_types) or hasattr(reactions, "<STR_LIT:id>"):<EOL><INDENT>warn("<STR_LIT>")<EOL>reactions = [reactions]<EOL><DEDENT>context = get_context(self)<EOL>for reaction in reactions:<EOL><INDENT>try:<EOL><INDENT>reaction = self.reactions[self.reactions.index(reaction)]<EOL><DEDENT>except ValueError:<EOL><INDENT>warn('<STR_LIT>' % (reaction, self))<EOL><DEDENT>else:<EOL><INDENT>forward = reaction.forward_variable<EOL>reverse = reaction.reverse_variable<EOL>if context:<EOL><INDENT>obj_coef = reaction.objective_coefficient<EOL>if obj_coef != <NUM_LIT:0>:<EOL><INDENT>context(partial(<EOL>self.solver.objective.set_linear_coefficients,<EOL>{forward: obj_coef, reverse: -obj_coef}))<EOL><DEDENT>context(partial(self._populate_solver, [reaction]))<EOL>context(partial(setattr, reaction, '<STR_LIT>', self))<EOL>context(partial(self.reactions.add, reaction))<EOL><DEDENT>self.remove_cons_vars([forward, reverse])<EOL>self.reactions.remove(reaction)<EOL>reaction._model = None<EOL>for met in reaction._metabolites:<EOL><INDENT>if reaction in met._reaction:<EOL><INDENT>met._reaction.remove(reaction)<EOL>if context:<EOL><INDENT>context(partial(met._reaction.add, reaction))<EOL><DEDENT>if remove_orphans and len(met._reaction) == <NUM_LIT:0>:<EOL><INDENT>self.remove_metabolites(met)<EOL><DEDENT><DEDENT><DEDENT>for gene in reaction._genes:<EOL><INDENT>if reaction in gene._reaction:<EOL><INDENT>gene._reaction.remove(reaction)<EOL>if context:<EOL><INDENT>context(partial(gene._reaction.add, reaction))<EOL><DEDENT>if remove_orphans and len(gene._reaction) == <NUM_LIT:0>:<EOL><INDENT>self.genes.remove(gene)<EOL>if context:<EOL><INDENT>context(partial(self.genes.add, gene))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>associated_groups = self.get_associated_groups(reaction)<EOL>for group in associated_groups:<EOL><INDENT>group.remove_members(reaction)<EOL><DEDENT><DEDENT><DEDENT>
Remove reactions from the model.

        The change is reverted upon exit when using the model as a context.

        Parameters
        ----------
        reactions : list
            A list with reactions (`cobra.Reaction`), or their id's, to remove

        remove_orphans : bool
            Remove orphaned genes and metabolites from the model as well