Python Detect Encoding Of Memory