if you didn't want to indent the entire thing, you could rename the method to _grade() or something, and then have a wrapper version of grade() call it using the context manager.