input: from typing import Optional
  
  class Node:
      def __init__(self, data):
          self.data = data
          self.next = None
          self.prev = None
  
  class DoubleLinkedList:
      def __init__(self): 
          self.head = None
  
      def append(self, new_data: int) -> None: 
          """
          Insert a new node at the end of the linked list.
          
          >>> dll = DoubleLinkedList()
          >>> dll.append(1)
          >>> dll.append(2)
          >>> dll.head.data
          1
          >>> dll.head.next.data
          2
          >>> dll.head.next.prev.data
          1
          """
          new_node = Node(new_data) 
          if self.head is None:
              self.head =  new_node
          else: 
              curr_node = self.head
              while curr_node.next != None:
                  curr_node = curr_node.next
              curr_node.next = new_node
              new_node.prev = curr_node
  
      def prepend(self, new_data: int) -> None:
          """
          Insert a new node at the beginning of the linked list.
          
          >>> dll = DoubleLinkedList()
          >>> dll.prepend(3)
          >>> dll.prepend(4)
          >>> dll.head.data
          4
          >>> dll.head.next.data
          3
          >>> dll.head.next.prev.data
          4
          """
          new_node = Node(new_data) 
          if self.head is None: 
              self.head = new_node
              return
          new_node.next = self.head
          self.head.prev = new_node 
          self.head = new_node
  
      def reverse(self) -> None:
          """
          Reverse the linked list in place.
          
          >>> dll = DoubleLinkedList()
          >>> dll.append(5)
          >>> dll.append(6)
          >>> dll.reverse()
          >>> dll.head.data
          6
          >>> dll.head.next.data
          5
          >>> dll.head.next.prev.data
          6
          """
          curr_node = self.head
          while curr_node:
              temp = curr_node.next
              curr_node.next = curr_node.prev
              curr_node.prev = temp
              curr_node = curr_node.prev
          if temp:
              self.head = temp.prev
output:     
          curr_node = self.head
          while curr_node:
              temp = curr_node.next
              curr_node.next = curr_node.prev
              curr_node.prev = temp
              curr_node = curr_node.prev
          if temp:
              self.head = temp.prev
  