def reverse_flux(reaction, ref_value, value):
    """

    Forces a reaction to have a minimum flux level in the opposite direction of a reference state.

    lb                           0                           ub
    |--------------------------- ' ---------------------------|
                      <----------'- - - - - - - ->

    Parameters
    ----------
    reaction: cobra.Reaction
        The reaction that will be inverted.
    ref_value: float
        The flux value to come from.
    value: float
        The flux value to achieve.

    """
    if (value >= 0) == (ref_value >= 0):
        raise ValueError(
            "'value' and 'ref_value' cannot have the same sign (%.5f, %.5f)" %
            (value, ref_value))
    if value > 0:
        reaction.upper_bound = value
    elif value < 0:
        reaction.lower_bound = value
    else:
        reaction.knock_out()
