<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def namespace(namespace):
 """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: Parameters: namespace(str):
 namespace to set as the current thread-local default. Returns: None """

    try:
        current_namespace = _namespace.current
    except AttributeError:
        current_namespace = None

    set_namespace(namespace)
    try:
        yield
    finally:
        set_namespace(current_namespace)