In the file hands_on/1_microscope_script.py [1], define a new context manager called sample_inserted that inserts a sample in the microscope before executing a block of code, and safely removes it at the end of the block.
Rewrite the brain-scan script from cell in the file using the do_stuff_under_vacuum and the sample_inserted context managers.
[1] https://github.com/ASPP/2019-camerino-advanced-python/tree/master/notebook/context%20manager/hands_on