def METHOD_NAME(values, target_min, target_max, source_min=None, source_max=None):
    """Scale the value of a numpy array "values"
    from source_min, source_max into a range [target_min, target_max]
    Parameters
    ----------
    values : Numpy array, required
        Values to be scaled.
    target_min : scalar, required
        Target minimum value.
    target_max : scalar, required
        Target maximum value.
    source_min : scalar, required, default: None
        Source minimum value if desired. If None, it will be the minimum of values.
    source_max : scalar, required, default: None
        Source minimum value if desired. If None, it will be the maximum of values.
    Returns
    -------
    res: Numpy array
        Output values mapped into range [target_min, target_max]
    """
    if source_min is None:
        source_min = np.min(values)
    if source_max is None:
        source_max = np.max(values)
    if source_min == source_max:  # improve this scenario
        source_min = 0.0
    values = (values - source_min) / (source_max - source_min)
    values = values * (target_max - target_min) + target_min
    return values