Utility function to clean outputs in notebooks and optionally check that they run without exceptions