<s> """<STR_LIT>""" <EOL> import os <EOL> REQUEST_ID_KEY = '<STR_LIT>' <EOL> _callback_storage = { } <EOL> def SetRequestEndCallback ( callback ) : <EOL> """<STR_LIT>""" <EOL> key = _GetRequestId ( ) <EOL> if key : <EOL> _callback_storage . setdefault ( key , [ ] ) . append ( callback ) <EOL> def InvokeCallbacks ( ) : <EOL> """<STR_LIT>""" <EOL> key = _GetRequestId ( ) <EOL> if key in _callback_storage : <EOL> for callback in _callback_storage [ key ] : <EOL> callback ( ) <EOL> del _callback_storage [ key ] <EOL> def _GetRequestId ( ) : <EOL> """<STR_LIT>""" <EOL> if REQUEST_ID_KEY in os . environ : <EOL> return os . environ [ REQUEST_ID_KEY ] <EOL> else : <EOL> return None </s>
