Adding convenience method for patching context managers