"""Implementation of Queue."""

from dll import DoublyLinkedList


class Queue(object):
    """Class implementation of queue.

    1.  Enqueue: Add new head node.
    2.  Dequeue: Remove tail node.
    3.  Peek: Display tail node,
    4.  Size: Display queue length.

    """

    def __init__(self, iterable=None):
        """Instatiate Queue."""
        self.dll = DoublyLinkedList(iterable)

    def enqueue(self, contents):
        """Add new head node."""
        self.dll.push(contents)

    def dequeue(self):
        """Remove last node."""
        old_tail_node_contents = self.dll.shift()
        return old_tail_node_contents

    def peek(self):
        """Display but don't remove the contents of tail node."""
        try:
            return self.dll.tail_node.contents
        except AttributeError:
            return None

    def size(self):
        """Return Queue length."""
        return self.dll.length
@@ -534,32 +534,49 @@
 e last node.%22%22%22%0A
+        try:%0A    
         old_tail
@@ -613,24 +613,28 @@
 t()%0A        
+    
 return old_t
@@ -650,16 +650,99 @@
 contents
+%0A        except IndexError:%0A            raise IndexError('Queue is already empty.')
 %0A%0A    de
@@ -1018,12 +1018,13 @@
 f.dll.length
+%0A

fix our dll