Bubble sort implementation in Python