added debug function for python.