replace reset.c with python code