On code isolation in Python
Python is a very dynamic language, and you can do a lot of things. This article demonstrates a few approaches on how to modify or extract the source code.
Source: On code isolation in Python, an article by Artem Golubin.