code: def add_context(msg: str) -> None:
      """Appends the error message to the error context stack.
  
      Args:
        msg: The error message to add to the error context stack.
  
      Returns:
        None.
  
      Raises:
        AttributeError if local thread has no current_context_msg attribute.
      """
      if not hasattr(context_holder, "current_context_msg"):
          raise AttributeError(
              "add_context called outside of reraise_with_context contextmanager."
          )
      context_holder.current_context_msg.messages.append(msg)
  
imports: import contextlib
  import dataclasses
  import threading
  from typing import Callable, Iterator, List, Type, Union
  from tensorflow_datasets.core import utils
label_desc: Use image node_id 2 for calling a global function with example usage: add_context(msg) without return types