code: def extract(code, tree, prefix=[]):
      
      if isinstance(tree, list):
          l, r = tree
          prefix.append('0')
          extract(code, l, prefix)
          prefix.pop()
          prefix.append('1')
          extract(code, r, prefix)
          prefix.pop()
      else:
          code[tree] = ''.join(prefix)
docs: Extract Huffman code from a Huffman tree
  
      :param tree: a node of the tree
      :param prefix: a list with the 01 characters encoding the path from
                      the root to the node `tree`
      :complexity: O(n)