code: def as_context(
      temporary_config: Optional[Config] = None,
  ) -> Generator[None, None, None]:
      """Ensure that global configs defaults, with a context manager. Useful for testing."""
      current_config = config()
      temporary_config = (
          replace(current_config)
          if temporary_config is None
          else temporary_config
      )
      try:
          set_config(temporary_config)
          yield
      finally:
          set_config(current_config)
  
imports: import contextlib
  import os
  from dataclasses import dataclass, field, replace
  from typing import Any, Dict, Generator, List, Mapping, Optional, Union
  import numpy
  import tabulate
  import tensorflow
  import tensorflow_probability
label_desc: Use image node_id 27 for calling a global function with example usage: as_context(temporary_config) without return types