String encoding&decoding with Python