Backwards compatibility - we use contextlib.nested to support Python 2.6, but it’s removed in Python 3.2.
Combine multiple context managers into a single nested context manager.
This function has been deprecated in favour of the multiple manager form of the with statement.
The one advantage of this function over the multiple manager form of the with statement is that argument unpacking allows it to be used with a variable number of context managers as follows:
with nested(*managers): do_something()