How To Create A Callback Function Python