def _activate(self, prev_ctx=None, thread_id=None):
        # activate this context if different from the previous context
        thread_id = thread_id if thread_id is not None else PyThread_get_thread_ident()
        if prev_ctx is None:
            try:
                prev_ctx = _current_contexts[thread_id]
            except KeyError:
                pass

        _current_contexts[thread_id] = self
        return Cookie(thread_id, prev_ctx)
set self as the current context
dataset/ETHPy150Open manahl/mdf/mdf/context.py/MDFContext._activate