finished smart_sort.py:method 1