fix content manager interface
Python doesn't allow module-level context managers because the magic
methods __enter__(), __exit__() are looked up on the class (i.e.
module), not on instances. See this for details:
http://bugs.python.org/issue12022#msg136640