This snippet allows one to implement an equivalent of a __getattr__()
function in a python module. The module can then define its own way to lazily import abitrary symbols. For example the module can contain infinitely many names or load values from other modules on demand.
There are many implementations of lazy imports in python, this is a simple one which doesn't interfere with python's import mechanism.