



from .stack import Stack







def  _UpperCAmelCase  (				SCREAMING_SNAKE_CASE__  ):


						'''simple docstring'''




						lowerCAmelCase	:   Stack[str]					     =					Stack()
						lowerCAmelCase	:   Tuple					     =					{"""(""": """)""", """[""": """]""", """{""": """}"""}
						for bracket in parentheses:
												if bracket in bracket_pairs:
																		stack.push(SCREAMING_SNAKE_CASE__  )
												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()

		lowerCAmelCase					:				Optional[Any]   	=['((()))', '((())', '(()))']
		print('Balanced parentheses demonstration:\n')
		for example in examples:
				lowerCAmelCase					:				str   	='' if balanced_parentheses(example) else 'not '
				print(F'''{example} is {not_str}balanced''')






def  _UpperCAmelCase  (				SCREAMING_SNAKE_CASE__  ):


						'''simple docstring'''




						lowerCAmelCase	:   List[str]					     =					str(SCREAMING_SNAKE_CASE__  ).strip()
						if not bin_string:
												raise ValueError("""Empty string was passed to the function"""  )
						lowerCAmelCase	:   Optional[int]					     =					bin_string[0] == """-"""
						if is_negative:
												lowerCAmelCase	:   Tuple					     =					bin_string[1:]
						if not all(char in """01""" for char in bin_string  ):
												raise ValueError("""Non-binary value was passed to the function"""  )
						lowerCAmelCase	:   Union[str, Any]					     =					0
						for char in bin_string:
												lowerCAmelCase	:   int					     =					2 * decimal_number + int(SCREAMING_SNAKE_CASE__  )
						return -decimal_number if is_negative else decimal_number


if __name__ == "__main__":
		from doctest import testmod

		testmod()

