code: def from_frequencies(cls, frequencies, concat=None):
          
          concat = concat or _guess_concat(next(iter(frequencies)))
  
          # Heap consists of tuples: (frequency, [list of tuples: (symbol, (bitsize, value))])
          heap = [(f, [(s, (0, 0))]) for s, f in frequencies.items()]
          # Add EOF symbol.
          # TODO: argument to set frequency of EOF?
          heap.append((1, [(_EOF, (0, 0))]))
  
          # Use heapq approach to build the encodings of the huffman tree leaves.
          heapify(heap)
          while len(heap) > 1:
              # Pop the 2 smallest items from heap
              a = heappop(heap)
              b = heappop(heap)
              # Merge nodes (update codes for each symbol appropriately)
              merged = (
                  a[0] + b[0],
                  [(s, (n + 1, v)) for (s, (n, v)) in a[1]]
                  + [(s, (n + 1, (1 << n) + v)) for (s, (n, v)) in b[1]]
              )
              heappush(heap, merged)
  
          # Code table is dictionary mapping symbol to (bitsize, value)
          table = dict(heappop(heap)[1])
  
          return cls(table, concat=concat, check=False)
docs: Build Huffman code table from given symbol frequencies
          :param frequencies: symbol to frequency mapping
          :param concat: function to concatenate symbols