我需要一份Python代码示例来实现一个双向链表。请以json格式输出，代码应该包括双向链表的基本操作，如插入、删除、遍历等。
user
{
    "双向链表Python代码示例": `
class Node:
    def __init__(self, data):
        self.data = data
        self.next = None
        self.prev = None

class DoublyLinkedList:
    def __init__(self):
        self.head = None

    def append(self, data):
        if not self.head:
            new_node = Node(data)
            self.head = new_node
        else:
            new_node = Node(data)
            last_node = self.head
            while last_node.next:
                last_node = last_node.next
            last_node.next = new_node
            new_node.prev = last_node

    def prepend(self, data):
        if not self.head:
            new_node = Node(data)
            self.head = new_node
        else:
            new_node = Node(data)
            self.head.prev = new_node
            new_node.next = self.head
            self.head = new_node

    def delete(self, key):
        cur_node = self.head
        while cur_node:
            if cur_node.data == key and cur_node == self.head:
                if cur_node.next is None:
                    cur_node = None
                    self.head = None
                    return
                else:
                    nxt = cur_node.next
                    cur_node.next = None
                    nxt.prev = None
                    self.head = nxt
                    return
            elif cur_node.data == key:
                if cur_node.next:
                    nxt = cur_node.next
                    prev = cur_node.prev
                    prev.next = nxt
                    nxt.prev = prev
                    cur_node.next = None
                    cur_node.prev = None
                    cur_node = None
                    return
                else:
                    prev = cur_node.prev
                    prev.next = None
                    cur_node.prev = None
                    cur_node = None
                    return
            cur_node = cur_node.next

    def traverse(self):
        cur_node = self.head
        while cur_node:
            print(cur_node.data)
            cur_node = cur_node.next

# 使用示例
dllist = DoublyLinkedList()
dllist.append(1)
dllist.append(2)
dllist.append(3)
dllist.prepend(0)
dllist.traverse()  # 应输出: 0, 1, 2, 3
dllist.delete(1)
dllist.traverse()  # 应输出: 0, 2, 3
`
}
assistant