input: 
  def traverse_both_directions(linked_list: DoubleLinkedList) -> List[Any]:
      """ Traverse the double linked list in both forward and backward directions
      and return a list that contains the data from the nodes in the order they were visited.
      The list should start with the data from the head node and end with the data from
      the last node in the forward direction, followed by the data from the last node and
      ending with the data from the head node in the backward direction.
  
      >>> traverse_both_directions(DoubleLinkedList().append(1).append(2).append(3))
      [1, 2, 3, 3, 2, 1]
      >>> traverse_both_directions(DoubleLinkedList().prepend(1).prepend(2))
      [2, 1, 1, 2]
      """
  
output:     result = []
      current = linked_list.head
      while current:
          result.append(current.data)
          current = current.next
      current = linked_list.tail
      while current:
          result.append(current.data)
          current = current.prev
      return result