Python Detect String Encoding And Decoding In Communication