def scale_to_range(min_max_old, element, min_max_new=[0, 10]):
    """Scale element from min_max_new to the new range, min_max_old.

    Args:
        min_max_old: Original range of the data, [min, max].
        element: Integer that will be scaled to the new range, must be
            within the old_range.
        min_max_new: New range of the data.

    Returns:
        element scaled to the new range.
    """
    new_range = min_max_new[1] - min_max_new[0]
    old_range = min_max_old[1] - min_max_old[0]
    return  ((element - min_max_old[0]) * new_range) / old_range