c++ rewrite
py