Get model from reaction name iterator.

        The model will contain all reactions of the iterator.

def load_model(cls, database, reaction_iter=None, exchange=None,
                   limits=None, v_max=None):
        """Get model from reaction name iterator.

        The model will contain all reactions of the iterator.
        """

        model_args = {}
        if v_max is not None:
            model_args['v_max'] = v_max

        model = cls(database, **model_args)
        if reaction_iter is None:
            reaction_iter = iter(database.reactions)
        for reaction_id in reaction_iter:
            model.add_reaction(reaction_id)

        # Apply reaction limits
        if limits is not None:
            for reaction_id, lower, upper in limits:
                if lower is not None:
                    model.limits[reaction_id].lower = lower
                if upper is not None:
                    model.limits[reaction_id].upper = upper

        # TODO: Currently we just create a new exchange reaction in the
        # database and add it to the model. Ideally, we should not modify
        # the database. The exchange reaction could be created on the
        # fly when required.
        if exchange is not None:
            for compound, reaction_id, lower, upper in exchange:
                # Create exchange reaction
                if reaction_id is None:
                    reaction_id = create_exchange_id(
                        model.database.reactions, compound)
                model.database.set_reaction(
                    reaction_id, Reaction(Direction.Both, {compound: -1}))
                model.add_reaction(reaction_id)
                if lower is not None:
                    model.limits[reaction_id].lower = lower
                if upper is not None:
                    model.limits[reaction_id].upper = upper

        return model