human
I am working on the file "Basic/LinkedList.ipynb".
The first task is:
C++
``` c++
inlcude <iostream>
struct ListNode
{
    int val;
    ListNode next;
    ListNode(int val, ListNode next=NULL):val(val), next(next){};
};
ListNode Reverseist(ListNode head)
{
    ListNode pre = NULL, tmp;
    while(head)
    {
        tmp = head->next;
        head->next = pre;
        pre = head;
        head = tmp;
    }
    return pre;
}
```
Dual Linked List
Python
Can you write Python program for it?
 Can you provide a the Python program you requested?
assistant
#Here is the Python program you requested.

class DListNode:
    def __init__(self, val):
        self.val = val
        self.prev = self.next = None
        
    def reverse(self, head):
        curt = None
        while head:
            curt = head
            head = curt.next
            curt.next = curt.prev
            curt.prev = head
        return curt