def receive(self, encoded):

        huffman_encoded_text, huffman_root, key, encrypted, dictionary = encoded

        # Huffman decoding
        huffman_decoded_text = huffman_decode(huffman_encoded_text, huffman_root)
        print "Huffman decoded"
        print huffman_decoded_text

        ###### Decryption ######
        b = ReducedArrayDecryption(huffman_decoded_text,key,encrypted[0]) 
        decrypted_text = b.decrypt()
        print "Decrypted text"
        print decrypted_text
        ########################

        # Run-length decoding
        rle_decoded_text = invert_rle(decrypted_text)
        print "RLE inverse"
        print rle_decoded_text    

        # Burrows-Wheeler Transform
        bwt_decoded_text = invert_BWT(rle_decoded_text)
        print "BWT inverse"
        print bwt_decoded_text

        # Dictionary decoding
        decoded_text = dictionary_decoding(bwt_decoded_text, dictionary)
        #print "Dictionary decoded"
        #print decoded_text
        with open('dictionary_decoding_output.txt', 'w') as f:
            f.write(decoded_text)

        return decoded_text
from HuffmanCoding import encode as huffman_encode
from HuffmanCoding import decode as huffman_decode


text = "l"

# Huffman coding
huffman_encoded_text, huffman_root = huffman_encode(text) # The root will be necessary to decode
print "Huffman", huffman_encoded_text

# Huffman decoding
huffman_decoded_text = huffman_decode(huffman_encoded_text, huffman_root)
print "Huffman decoded", huffman_decoded_text