code: def config_prefix(prefix: str) -> Generator[None, None, None]:
      """
      contextmanager for multiple invocations of API with a common prefix
  
      supported API functions: (register / get / set )__option
  
      Warning: This is not thread - safe, and won't work properly if you import
      the API functions into your module using the "from x import y" construct.
  
      Example
      -------
      import pandas._config.config as cf
      with cf.config_prefix("display.font"):
          cf.register_option("color", "red")
          cf.register_option("size", " 5 pt")
          cf.set_option(size, " 6 pt")
          cf.get_option(size)
          ...
  
          etc'
  
      will register options "display.font.color", "display.font.size", set the
      value of "display.font.size"... and so on.
      """
      # Note: reset_option relies on set_option, and on key directly
      # it does not fit in to this monkey-patching scheme
  
      global register_option, get_option, set_option
  
      def wrap(func: F) -> F:
          def inner(key: str, *args, **kwds):
              pkey = f"{prefix}.{key}"
              return func(pkey, *args, **kwds)
  
          return cast(F, inner)
  
      _register_option = register_option
      _get_option = get_option
      _set_option = set_option
      set_option = wrap(set_option)
      get_option = wrap(get_option)
      register_option = wrap(register_option)
      try:
          yield
      finally:
          set_option = _set_option
          get_option = _get_option
          register_option = _register_option
  
imports: from __future__ import annotations
  from contextlib import ContextDecorator, contextmanager
  import re
  from typing import TYPE_CHECKING, Any, Callable, Generic, NamedTuple, cast
  import warnings
  from pandas._typing import F, T
  from pandas.util._exceptions import find_stack_level
label_desc: Use image node_id 18 for calling a global function with example usage: config_prefix(prefix) and returns: cast, func