torch.jit.is_scripting() can be used as a guard for Python-only methods, which are not exportable.
Since the JIT cannot export all arbitrary Python objects, you could thus use different “paths” in your code for the Python execution and the scripting of the mdoel.
handle_torch_function sounds like a custom function definition.



 f10w:

Where can I learn those things in detail so that I can myself write similar custom functions and stop asking stupid questions like these?


As these features are currently being developed, the documentation and tutorials might not be up to date, so please ask these kind of questions here. 
torch.jit.is_scripting can be found in the current master docs 182, but might also be updated before the next release.