给你一个列表，请你编写代码实现归并排序算法，并输出排序后的列表。

[4, 1, 7, 3, 8, 5, 9, 2, 6]
```
def merge_sort(lst):
    if len(lst) <= 1:
        return lst

    mid = len(lst) // 2
    left = lst[:mid]
    right = lst[mid:]

    left = merge_sort(left)
    right = merge_sort(right)

    return merge(left, right)

def merge(left, right):
    res = []
    i = j = 0

    while i < len(left) and j < len(right):
        if left[i] < right[j]:
            res.append(left[i])
            i += 1
        else:
            res.append(right[j])
            j += 1

    res += left[i:]
    res += right[j:]

    return res

lst = [4, 1, 7, 3, 8, 5, 9, 2, 6]
print(merge_sort(lst))
``` 

输出为 [1, 2, 3, 4, 5, 6, 7, 8, 9]