from heapq import merge

def merge_sort(m):
    if len(m) <= 1:
        return m

    middle = len(m) 
    left = m[:middle]
    right = m[middle:]

    left = merge_sort(left)
    right = merge_sort(right)
    return list(merge(left, right))