Fine tune and document application context behaviour (#488)
This MR adds more thorough testing of application context behaviour for threads and asyncio Tasks, and documents expected behaviour more clearly.
It also wraps application context implementation in a way that makes it easier to switch backend storage in the future.
Edited by Enrico Zini