[python] add codecs.encode/decode