docstr: Configure the Sentry scope for the current thread.
  
  This function should be called at the beginning of every thread that
  will send events to Sentry. It sets the tags that will be applied to
  all events sent from this thread. It also tries to start a session
  if one doesn't already exist for this thread.
docstr_tok: ["Configure","the","Sentry","scope","for","the","current","thread",".","This","function","should","be","called","at","the","beginning","of","every","thread","that","will","send","events","to","Sentry",".","It","sets","the","tags","that","will","be","applied","to","all","events","sent","from","this","thread",".","It","also","tries","to","start","a","session","if","one","does","n't","already","exist","for","this","thread","."]
code: def configure_scope(
      self,
      tags: Optional[Dict[str, Any]] = None,
      process_context: Optional[str] = None,
  ) -> None:
      """Configure the Sentry scope for the current thread.
  
      This function should be called at the beginning of every thread that
      will send events to Sentry. It sets the tags that will be applied to
      all events sent from this thread. It also tries to start a session
      if one doesn't already exist for this thread.
      """
      assert self.hub is not None
      settings_tags = (
          "entity",
          "project",
          "run_id",
          "run_url",
          "sweep_url",
          "sweep_id",
          "deployment",
          "_disable_service",
          "_require_core",
          "launch",
      )
  
      with self.hub.configure_scope() as scope:
          scope.set_tag("platform", wandb.util.get_platform_name())
  
          # set context
          if process_context:
              scope.set_tag("process_context", process_context)
  
          # apply settings tags
          if tags is None:
              return None
  
          for tag in settings_tags:
              val = tags.get(tag, None)
              if val not in (None, ""):
                  scope.set_tag(tag, val)
  
          if tags.get("_colab", None):
              python_runtime = "colab"
          elif tags.get("_jupyter", None):
              python_runtime = "jupyter"
          elif tags.get("_ipython", None):
              python_runtime = "ipython"
          else:
              python_runtime = "python"
          scope.set_tag("python_runtime", python_runtime)
  
          # Construct run_url and sweep_url given run_id and sweep_id
          for obj in ("run", "sweep"):
              obj_id, obj_url = f"{obj}_id", f"{obj}_url"
              if tags.get(obj_url, None):
                  continue
  
              try:
                  app_url = wandb.util.app_url(tags["base_url"])  # type: ignore
                  entity, project = (quote(tags[k]) for k in ("entity", "project"))  # type: ignore
                  scope.set_tag(
                      obj_url,
                      f"{app_url}/{entity}/{project}/{obj}s/{tags[obj_id]}",
                  )
              except Exception:
                  pass
  
          email = tags.get("email")
          if email:
              scope.user = {"email": email}  # noqa
  
      # todo: add back the option to pass general tags see: c645f625d1c1a3db4a6b0e2aa8e924fee101904c (wandb/util.py)
  
      self.start_session()
  
imports: import atexit
  import functools
  import os
  import pathlib
  import sys
  from types import TracebackType
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type, Union
  from urllib.parse import quote
  import sentry_sdk
  import sentry_sdk.utils
  import wandb
  import wandb.env
  import wandb.util
label_desc: Use image node_id 10 for calling the Sentry obj's underlying member method code with example usage: obj.configure_scope(tags, process_context) and returns: None