Need to implement this code generator https://github.com/RustPython/RustPython/blob/master/parser/src/compiler/compile_py_code_object.rs you can use the compile.rs file in the same folder as a reference.