code: def get_script_run_ctx(
      suppress_warning: bool = False,
  ) -> Optional[ScriptRunContext]:
      """
      Parameters
      ----------
      suppress_warning : bool
          If True, don't log a warning if there's no ScriptRunContext.
      Returns
      -------
      ScriptRunContext | None
          The current thread's ScriptRunContext, or None if it doesn't have one.
  
      """
      thread = threading.current_thread()
      ctx: Optional[ScriptRunContext] = getattr(
          thread, SCRIPT_RUN_CONTEXT_ATTR_NAME, None
      )
      if ctx is None and runtime.exists() and not suppress_warning:
          # Only warn about a missing ScriptRunContext if suppress_warning is False, and
          # we were started via `streamlit run`. Otherwise, the user is likely running a
          # script "bare", and doesn't need to be warned about streamlit
          # bits that are irrelevant when not connected to a session.
          LOGGER.warning(
              "Thread '%s': missing ScriptRunContext", thread.name
          )
  
      return ctx
  
imports: import collections
  import contextvars
  import threading
  from dataclasses import dataclass, field
  from typing import Callable, Counter, Dict, List, Optional, Set, Tuple
  from urllib import parse
  from typing_extensions import Final, TypeAlias
  from streamlit import runtime
  from streamlit.errors import StreamlitAPIException
  from streamlit.logger import get_logger
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
  from streamlit.proto.PageProfile_pb2 import Command
  from streamlit.runtime.scriptrunner.script_requests import ScriptRequests
  from streamlit.runtime.state import SafeSessionState
  from streamlit.runtime.uploaded_file_manager import UploadedFileManager
  import streamlit
label_desc: Use image node_id 2 for calling a global function with example usage: get_script_run_ctx(suppress_warning) and returns: ctx