It is an easy way to provide an __enter__() and __exit__() to functions. If you don't like it I can refactor. The reason it's in is because it makes the code more readable.