def weight_normalize1D(lst, invert, normalize_max):
    """
    Used to normalize 1 dimensional list (unary values) according to their weight (normalize_max) and also takes into
    inversion into account while returning.

    :param lst: 1D list of items.
    :param invert: boolean variable, invert the values or not
    :param normalize_max: weight of this metric
    :return: normalized 1D list
    """

    sz = len(lst)
    if normalize_max == 0:
        return [0.0 for i in range(sz)]
    else:
        max_val = max(lst)
        if max_val > 0.0:
            norm_list = list()
            for i in range(sz):
                val = (lst[i] * normalize_max) / max_val
                if invert:
                    val = normalize_max - val
                norm_list.append(val)
            return norm_list
        else:
            if invert:
                for i in range(sz):
                    lst[i] = normalize_max - lst[i]
            return lst