new file:   core/tools/encode.py