def rescale_value(original, prev_min, prev_max, min, max):
    """Rescale a given value.
    Given the value, the current min and max and the new min and max
    produce the rescaled value
    """
    f = float(original - prev_min) / (prev_max - prev_min)
    return min + ((max - min) * f)