For this Question: The head of the doubly linked list will be given to you, and you must sort it using merge sort.You will be given the head of doubly Linked List and its length.

Constraints:
0<= n <=10000Return the HEAD of the sorted linked list.Sample Input:
5
3 2 1 3 2 
Output:
1 2 2 3 3, I have written this Solution Code: class Node:
    def __init__(self, data, next=None, prev=None):
        self.data = data
        self.next = next
        self.prev = prev
 
 
def push(head, key):
 
    node = Node(key, head)
 
    if head:
        head.prev = node
 
    return node
 
 
def printDDL(head):
 
    while head: 
        print(head.data, end=' ')
        head = head.next
 
 
def split(head):
 
    slow = head
    fast = head.next
 
    while fast:
        fast = fast.next
        if fast:
            slow = slow.next
            fast = fast.next
 
    return slow
 
 
def merge(a, b):
 
    if a is None:
        return b
 
    if b is None:
        return a
 
    if a.data <= b.data:
        a.next = merge(a.next, b)
        a.next.prev = a
        a.prev = None
        return a
    else:
        b.next = merge(a, b.next)
        b.next.prev = b
        b.prev = None
        return b
 
 
def mergesort(head):
 
    if head is None or head.next is None:
        return head
 
    a = head
 
    slow = split(head)
    b = slow.next
    slow.next = None
 
    a = mergesort(a)
    b = mergesort(b)
 
    head = merge(a, b)
    return head
 
 
 
n=int(input())
keys=list(map(int,input().split()))

head = None
for key in keys:
    head = push(head, key)

head = mergesort(head)
printDDL(head), In this Programming Language: Python, Now tell me if this Code is compilable or not?