class_docstr: a node in a Huffman tree
class_docstr_tok: ["a","node","in","a","Huffman","tree"]
code: def decode(self, bits: bitarray) -> tp.Iterator["HuffmanNode"]:
      current_node = self
      for bit in bits:
          if bit == 0:  # go right
              current_node = current_node.right
          else:  # go left
              current_node = current_node.left
          if current_node is None:
              # we shouldn't be on a leaf here
              raise Exception("fell off a leaf")
          if current_node.is_leaf():
              yield current_node
              current_node = self
      if current_node != self:
          raise Exception("couldn't decode all the bits")
  
imports: import re
  import typing
  from collections import Counter, deque
  from dataclasses import dataclass
  from bitarray import bitarray, util
  from fairseq.data import Dictionary
label_desc: Use image node_id 3 for calling the HuffmanNode obj's underlying member method code with example usage: obj.decode(bits) without return types