Right now we need two context managers to use the library:
- initialize the global context with
global_context_initialized.
- add the context with
add_global_context.
It would be great if add_global_context can manage the context automatically:
- detect if the context is initialized.
- if it isn't, initialize and save the state.
- when
add_global_context ends, close the global context.
It's important to be reentrant to an add_global_context within another add_global_context doesn't close the context too soon.