the definition for the node class remains the same as the node we defined when we touched on doubly linked listthe doubly linked list can be treated as queue if it enables fifo kind of data accesswhere the first element added to the list is the first to be removed queue class the queue class is very similar to that of the doubly linked list classclass queuedef __init__(self)self head none self tail none self count self head and self tail pointers are set to none upon creation of an instance of the queue class to keep count of the number of nodes in queuethe count instance variable is maintained here too and set to enqueue operation elements are added to queue object via the enqueue method the elements in this case are the nodesdef enqueue(selfdata)new_node node(datanonenoneif self head is noneself head new_node self tail self head elsenew_node prev self tail self tail next new_node self tail new_node self count + the enqueue method code is the same code already explained in the append operation of the doubly linked list it creates node from the data passed to it and appends it to the tail of the queueor points both self head and self tail to the newly created node if the queue is empty the total count of elements in the queue is increased by the line self count +