```
def remove_head(self):
removed_head = self.head_node
if removed_head == None:
return None
self.head_node = removed_head.get_next_node()
if self.head_node != None:
self.head_node.set_prev_node(None)
if removed_head == self.tail_node:
self.remove_tail()
return removed_head.get_value()
def remove_tail(self):
removed_tail = self.tail_node
if removed_tail == None:
return None
self.tail_node = removed_tail.get_prev_node()
if self.tail_node != None:
self.tail_node.set_next_node(None)
if removed_tail == self.head_node:
self.remove_head()
return removed_tail.get_value()
```

In the code given here on removing a head/tail from a doubly linked list, I’m puzzled at this one line of code. There’s a line where we check if the head node is also the tail node (Which implies that there is only one node in the list). We use the .remove_tail() method if the head is also the tail. Similarly, we use the .remove_head() method if the tail is also the head. Won’t the two functions call each other indefinitely? Why are we using a method here?