Python code: callback