def index_sort(list_var):

    """
    This function sorts index based on a given lists element value.
    """
    length = len(list_var)
    list_index = list(range(0, length))
    
    x = list_var
    for i in range(length):
        for j in range(length):
            if x[list_index[i]] > x[list_index[j]]:
                #swap
                temp = list_index[i]
                list_index[i]= list_index[j]
                list_index[j]= temp

    return list_index