def renormalize(values, old_min, old_max, new_min, new_max):
    """
    Transforms values in range [old_min, old_max] to values in range [new_min, new_max]
    """
    return (new_max - new_min) * (values - old_min) / (old_max -
                                                       old_min) + new_min