def rescale(values, old_min, old_max, new_min, new_max):
    """Rescale a set of values into a new min and max

    """
    output = []

    for v in values:
        new_v = (new_max - new_min) * (v - old_min) / (old_max - old_min) + new_min
        output.append(new_v)

    return output