@contextmanager
def docutils_namespace():
 try:
  _directives = copy(directives._directives)
  _roles = copy(roles._roles)
  (yield)
 finally:
  directives._directives = _directives
  roles._roles = _roles

@ contextmanager def docutils_namespace ( ) : try : _directives = copy ( directives . _directives ) _roles = copy ( roles . _roles ) ( yield ) finally : directives . _directives = _directives roles . _roles = _roles
create namespace for rest parsers .