def make_two_way(singlyll):
    if singlyll == None:
        return (None, None)
    temp = singlyll
    doublyll = TwoWayNode(temp.data)
    temp2 = doublyll
    while temp.next != None:
        temp = temp.next
        new_node = TwoWayNode(temp.data, previous=doublyll)
        doublyll.next = new_node
        doublyll = doublyll.next
    return (temp2, doublyll)
 def append(self, data):
     node = TwoWayNode(data)
     if self.head == None:
         self.head = node
         self.head.next = self.head
         self.tail = self.head
         self.size += 1
     else:
         probe = self.head
         while probe.next != self.head:
             probe = probe.next
         probe.next = node
         node.next = self.head
         node.previous = probe
         self.tail = node
         self.size += 1
    def enqueue(self, data):
        new_node = TwoWayNode(data)

        if self.count == 0:
            self.head = new_node
            self.head.next = self.head
            self.tail = self.head
        else:
            probe = self.head
            while probe.next != self.head:
                probe = probe.next
            probe.next = new_node
            new_node.next = self.head
            new_node.previous = probe
            self.tail = new_node

        self.count += 1