util.py
def decode_byte(tree, bitreader):
	"""
	Reads bits from the bit reader and traverses the tree from
	the root to a leaf. Once a leaf is reached, bits are no longer read
	and the value of that leave is returned.

	Args:
	bitreader: An instance of bitio.BitReader to read the tree from.
	tree: A Huffman tree.

	Returns:
	Next byte of the compressed bit stream.
	"""
	#the root node of tree
	node = tree
	#to decode, we should get the tree leaf value
	while isinstance(node, huffman.TreeBranch):
		#avoid the EOFError
		try:
			bit = bitreader.readbit()
		except EOFError:
			break
		#traverse the tree to reach the leaf
		if bit == 0:
			node = node.left
		elif bit == 1:
			node = node.right
		#if reach the leaf return the value of leaf
		if isinstance(node, huffman.TreeLeaf):
			return node.value
			break

	Reads bits from the bit reader and traverses the tree from
	the root to a leaf. Once a leaf is reached, bits are no longer read
	and the value of that leave is returned.

	Args:
	bitreader: An instance of bitio.BitReader to read the tree from.
	tree: A Huffman tree.

	Returns:
	Next byte of the compressed bit stream.
	
Reads bits from the bit reader and traverses the tree from
the root to a leaf. Once a leaf is reached, bits are no longer read
and the value of that leave is returned.

An instance of bitio.BitReader to read the tree from.
tree: A Huffman tree.

Next byte of the compressed bit stream.
Reads bits from the bit reader and traverses the tree from the root to a leaf . Once a leaf is reached bits are no longer read and the value of that leave is returned . An instance of bitio . BitReader to read the tree from . tree : A Huffman tree . Next byte of the compressed bit stream .
def decode_byte(tree, bitreader):
	node = tree
	while isinstance(node, huffman.TreeBranch):
		try:
			bit = bitreader.readbit()
		except EOFError:
			break
		if bit == 0:
			node = node.left
		elif bit == 1:
			node = node.right
		if isinstance(node, huffman.TreeLeaf):
			return node.value
			break
def decode_byte ( tree , bitreader ) : node = tree while isinstance ( node , huffman . TreeBranch ) : try : bit = bitreader . readbit ( ) except EOFError : break if bit == 0 : node = node . left elif bit == 1 : node = node . right if isinstance ( node , huffman . TreeLeaf ) : return node . value break
Reads bits from the bit reader and traverses the tree from
the root to a leaf.
Reads bits from the bit reader and traverses the tree from the root to a leaf .
"""
	Reads bits from the bit reader and traverses the tree from
	the root to a leaf. Once a leaf is reached, bits are no longer read
	and the value of that leave is returned.

	Args:
	bitreader: An instance of bitio.BitReader to read the tree from.
	tree: A Huffman tree.

	Returns:
	Next byte of the compressed bit stream.
	""" #the root node of tree #to decode, we should get the tree leaf value #avoid the EOFError #traverse the tree to reach the leaf #if reach the leaf return the value of leaf
tree
bitreader