Backports and enhancements for the contextlib module

WWW: http://contextlib2.readthedocs.org/
