code: 
  """simple docstring"""
  class    _lowerCAmelCase						:
  
  
  
  							def __init__(      self ,						a_   )							->							str:
  								_UpperCAmelCase =						data
  								_UpperCAmelCase =						None
  								_UpperCAmelCase =						None
  
  
  
  							def __str__(      self   )							->							str:
  								return f"{self.data}"
  
  
  
  
  
  class    _lowerCAmelCase						:
  
  
  
  							def __init__(      self   )							->							int:
  								_UpperCAmelCase =						None
  								_UpperCAmelCase =						None
  
  
  
  							def __iter__(      self   )							->							Dict:
  								_UpperCAmelCase =						self.head
  								while node:
  									yield node.data
  									_UpperCAmelCase =						node.next
  
  
  
  							def __str__(      self   )							->							Dict:
  								return "->".join([str(a_   ) for item in self]   )
  
  
  
  							def __len__(      self   )							->							Optional[Any]:
  								return sum(1 for _ in self   )
  
  
  
  							def       _a   (      self ,						a_   )							->							int:
  								self.insert_at_nth(0 ,						a_   )
  
  
  
  							def       _a   (      self ,						a_   )							->							Union[str, Any]:
  								self.insert_at_nth(len(self   ) ,						a_   )
  
  
  
  							def       _a   (      self ,						a_ ,						a_   )							->							str:
  								_UpperCAmelCase =						len(self   )
  
  								if not 0 <= index <= length:
  									raise IndexError("list index out of range"   )
  								_UpperCAmelCase =						Node(a_   )
  								if self.head is None:
  									_UpperCAmelCase =						_UpperCAmelCase =						new_node
  								elif index == 0:
  									_UpperCAmelCase =						new_node
  									_UpperCAmelCase =						self.head
  									_UpperCAmelCase =						new_node
  								elif index == length:
  									_UpperCAmelCase =						new_node
  									_UpperCAmelCase =						self.tail
  									_UpperCAmelCase =						new_node
  								else:
  									_UpperCAmelCase =						self.head
  									for _ in range(0 ,						a_   ):
  										_UpperCAmelCase =						temp.next
  									_UpperCAmelCase =						new_node
  									_UpperCAmelCase =						temp.previous
  									_UpperCAmelCase =						temp
  									_UpperCAmelCase =						new_node
  
  
  
  							def       _a   (      self   )							->							str:
  								return self.delete_at_nth(0   )
  
  
  
  							def       _a   (      self   )							->							List[str]:
  								return self.delete_at_nth(len(self   ) - 1   )
  
  
  
  							def       _a   (      self ,						a_   )							->							Tuple:
  								_UpperCAmelCase =						len(self   )
  
  								if not 0 <= index <= length - 1:
  									raise IndexError("list index out of range"   )
  								_UpperCAmelCase =						self.head  # default first node
  								if length == 1:
  									_UpperCAmelCase =						_UpperCAmelCase =						None
  								elif index == 0:
  									_UpperCAmelCase =						self.head.next
  									_UpperCAmelCase =						None
  								elif index == length - 1:
  									_UpperCAmelCase =						self.tail
  									_UpperCAmelCase =						self.tail.previous
  									_UpperCAmelCase =						None
  								else:
  									_UpperCAmelCase =						self.head
  									for _ in range(0 ,						a_   ):
  										_UpperCAmelCase =						temp.next
  									_UpperCAmelCase =						temp
  									_UpperCAmelCase =						temp.previous
  									_UpperCAmelCase =						temp.next
  								return delete_node.data
  
  
  
  							def       _a   (      self ,						a_   )							->							str:
  								_UpperCAmelCase =						self.head
  
  								while current.data != data:  # Find the position to delete
  									if current.next:
  										_UpperCAmelCase =						current.next
  									else:  # We have reached the end an no value matches
  										raise ValueError("No data matching given value"   )
  
  								if current == self.head:
  									self.delete_head()
  
  								elif current == self.tail:
  									self.delete_tail()
  
  								else:  # Before: 1 <--> 2(current) <--> 3
  									_UpperCAmelCase =						current.next  # 1 --> 3
  									_UpperCAmelCase =						current.previous  # 1 <--> 3
  								return data
  
  
  
  							def       _a   (      self   )							->							Optional[int]:
  								return len(self   ) == 0
  
  
  
  
  
  def     __lowerCamelCase  (		):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	_UpperCAmelCase =						DoublyLinkedList()
  	assert linked_list.is_empty() is True
  	assert str(UpperCamelCase__      ) == ""
  
  	try:
  		linked_list.delete_head()
  		raise AssertionError  # This should not happen.
  	except IndexError:
  		assert True  # This should happen.
  
  	try:
  		linked_list.delete_tail()
  		raise AssertionError  # This should not happen.
  	except IndexError:
  		assert True  # This should happen.
  
  	for i in range(10      ):
  		assert len(UpperCamelCase__      ) == i
  		linked_list.insert_at_nth(UpperCamelCase__				,     i + 1      )
  	assert str(UpperCamelCase__      ) == "->".join(str(UpperCamelCase__      ) for i in range(1				,     11      )      )
  
  	linked_list.insert_at_head(0      )
  	linked_list.insert_at_tail(11      )
  	assert str(UpperCamelCase__      ) == "->".join(str(UpperCamelCase__      ) for i in range(0				,     12      )      )
  
  	assert linked_list.delete_head() == 0
  	assert linked_list.delete_at_nth(9      ) == 10
  	assert linked_list.delete_tail() == 11
  	assert len(UpperCamelCase__      ) == 9
  	assert str(UpperCamelCase__      ) == "->".join(str(UpperCamelCase__      ) for i in range(1				,     10      )      )
  
  
  if __name__ == "__main__":
  			from doctest import testmod
  
  			testmod()
  
  
  
  
  
style_context: 
  """simple docstring"""
  from .stack import Stack
  
  
  
  
  def     __lowerCamelCase  (		UpperCamelCase__      ):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	_UpperCAmelCase =						Stack()
  	_UpperCAmelCase =						{"(": ")", "[": "]", "{": "}"}
  	for bracket in parentheses:
  		if bracket in bracket_pairs:
  			stack.push(UpperCamelCase__      )
  		elif bracket in (")", "]", "}"):
  			if stack.is_empty() or bracket_pairs[stack.pop()] != bracket:
  				return False
  	return stack.is_empty()
  
  
  if __name__ == "__main__":
  			from doctest import testmod
  
  			testmod()
  
  			__magic_name__		       =				['''((()))''', '''((())''', '''(()))''']
  			print('''Balanced parentheses demonstration:\n''')
  			for example in examples:
  						__magic_name__		       =				'''''' if balanced_parentheses(example) else '''not '''
  						print(f'''{example} is {not_str}balanced''')
  
  
  
  
  