def bubble_sort_2nd_value(tuples_list):
    NEWLIST = []
ITEM_MOVE = 0
for i in tuples_list:
    NEWLIST.append(i)
for i in range(len(NEWLIST)):
    for j in range(len(NEWLIST) - 1):
        k = j + 1
if NEWLIST[j][1] > NEWLIST[k][1]:
    ITEM_MOVE = 1
NEWLIST[j], NEWLIST[k] = NEWLIST[k], NEWLIST[j]
if ITEM_MOVE == 0:
    print(tuples_list)
else:
    print(NEWLIST)
tuples_list = [('h2', 8), ('h4', 30), ('h6', 7), ('h8', 54), ('h1', 72), (
    'h3', 8), ('h5', 7), ('h7', 15), ('h7', 24)]
bubble_sort_2nd_value(tuples_list)
stable sorting using python bubble sort