<prompt> Tekeleza algoriti rahisi ya usimbaji ya Huffman katika Python ambayo huchukua mfuatano kama ingizo na kutoa uwakilishi wa binary uliosimbwa wa mfuatano wa ingizo, pamoja na mti wa kusimbua.PLINFORMAT  <response>: kuagiza rundonodi ya darasa: def __init__binafsi, char, freq: self.char char self.freq mara kwa mara self.left Hakuna self.right Hakuna def __lt__binafsi, nyingine: return self.freq other.freqdef calc_freqkamba: freq_dict kwa char katika kamba: ikiwa char haiko katika freq_dict: freq_dictchar 0 freq_dictchar 1 kurudi freq_dictdef build_treefreq_dict: heap Njiachar, freq ya char, freq in freq_dict.items heapq.heapifyrundo wakati lenlundo 1: left_node heapq.heappoplundo right_nodi heapq.heappoplundo parent_nodi Njia Hakuna, left_node.freq right_node.freq parent_node.left left_nodi parent_nodi.right right_nodi heapq.heapppushlundo, nodi_ya_mzazi rundo la kurudi0def generate_codesnodi, kanuni, kanuni_dict: ikiwa nodi ni Hakuna: kurudi ikiwa node.char sio Hakuna: code_dictnode.char msimbo kurudi generate_codesnode.left, code 0, code_dict generate_codesnode.right, code 1, code_dictdef huffman_encodekamba: freq_dict calc_freqkamba tree_root build_treefreq_dict kanuni_dict kuzalisha_misimbomizizi_ya_mti, , kanuni_dict encoded_string .jiungecode_dictchar kwa char katika mfuatano rudisha kamba_iliyosimbwa, mti_mzizidef huffman_decodeencoded_string, tree_root: decoded_string sasa_nodi mti_mzizi kwa bit in encoded_string: ikiwa kidogo 0: current_nodi current_node.left kwingine: current_nodi current_node.right ikiwa current_node.char sio Hakuna: decoded_string current_node.char sasa_nodi mti_mzizi rudisha mfuatano wa decodedkama __name__ __main__: input_string Huffman coding algoriti usimbaji_binary, decoding_tree huffman_encodeinput_string printUwakilishi wa binary uliosimbwa:, iliyosimbwa_binary printKamba iliyosimbuliwa:, huffman_decodeencoded_binary, decoding_tree 