How To Create A Callback Function In Python