Python Detect String Encoding And Decoding Communication