docstr: Get the ScriptRunContext for the current thread.
  
  Returns
  -------
  ScriptRunContext
      The ScriptRunContext for the current thread.
  
  Raises
  ------
  AssertionError
      If called outside of a ScriptRunner thread.
  RuntimeError
      If there is no ScriptRunContext for the current thread.
docstr_tok: ["Get","the","ScriptRunContext","for","the","current","thread",".","Returns","--","--","--","-","ScriptRunContext","The","ScriptRunContext","for","the","current","thread",".","Raises","--","--","--","AssertionError","If","called","outside","of","a","ScriptRunner","thread",".","RuntimeError","If","there","is","no","ScriptRunContext","for","the","current","thread","."]
code: def _get_script_run_ctx(self) -> ScriptRunContext:
      """Get the ScriptRunContext for the current thread.
  
      Returns
      -------
      ScriptRunContext
          The ScriptRunContext for the current thread.
  
      Raises
      ------
      AssertionError
          If called outside of a ScriptRunner thread.
      RuntimeError
          If there is no ScriptRunContext for the current thread.
  
      """
      assert self._is_in_script_thread()
  
      ctx = get_script_run_ctx()
      if ctx is None:
          # This should never be possible on the script_runner thread.
          raise RuntimeError(
              "ScriptRunner thread has a null ScriptRunContext. Something has gone very wrong!"
          )
      return ctx
  
imports: import gc
  import sys
  import threading
  import types
  from contextlib import contextmanager
  from enum import Enum
  from timeit import default_timer
  from typing import Callable, Dict, Optional
  from blinker import Signal
  from streamlit import config, runtime, source_util, util
  from streamlit.error_util import handle_uncaught_app_exception
  from streamlit.logger import get_logger
  from streamlit.proto.ClientState_pb2 import ClientState
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
  from streamlit.runtime.scriptrunner.script_cache import ScriptCache
  from streamlit.runtime.scriptrunner.script_requests import RerunData, ScriptRequests, ScriptRequestType
  from streamlit.runtime.scriptrunner.script_run_context import ScriptRunContext, add_script_run_ctx, get_script_run_ctx
  from streamlit.runtime.state import SCRIPT_RUN_WITHOUT_ERRORS_KEY, SafeSessionState, SessionState
  from streamlit.runtime.uploaded_file_manager import UploadedFileManager
  from streamlit.vendor.ipython.modified_sys_path import modified_sys_path
label_desc: Use image node_id 6 for calling the ScriptRunner obj's underlying member method code with example usage: obj._get_script_run_ctx() and returns: ctx