added logging to python code