def METHOD_NAME():
    from bitarray.util import _huffman_tree
    freq = {'a': 10, 'b': 2, 'c': 1}
    tree = _huffman_tree(freq)
    code = huff_code(tree)
    assert len(code['a']) == 1
    assert len(code['b']) == len(code['c']) == 2
    code = {'a': bitarray('0'),
            'b': bitarray('10'),
            'c': bitarray('11')}
    tree = make_tree(code)
    txt = 'abca'
    a = bitarray()
    a.encode(code, txt)
    assert a == bitarray('010110')
    assert ''.join(iterdecode(tree, a)) == txt