isolate_example function

Isolate the side effects of an example.