code: def namespace(namespace):
      
      try:
          current_namespace = _namespace.current
      except AttributeError:
          current_namespace = None
  
      set_namespace(namespace)
      try:
          yield
      finally:
          set_namespace(current_namespace)
docs: Context manager for stacking the current thread-local default
      namespace.  Exiting the context sets the thread-local default
      namespace back to the previously-set namespace.  If there is no
      previous namespace, then the thread-local namespace is cleared.
  
      Example:
        >>> with namespace("foo"):
        ...   with namespace("bar"):
        ...     assert get_namespace() == "bar"
        ...   assert get_namespace() == "foo"
  
        >>> assert get_namespace() == ""
  
      Parameters:
        namespace(str): namespace to set as the current thread-local
          default.
  
      Returns:
        None