add __enter__ and __exit__ methods to functions with an unload method