def apply_media(model, media):
    """Applies media <dict> to model by setting the compound /
    reaction's upper bounds."""
    for rxn_id, upper_bound in media.items():
        model.reactions.get_by_id(rxn_id).upper_bound = upper_bound
    return model