docs: def invoke_tool (namespace, tool_class=None):
      """Invoke a tool and exit.
  
      `namespace` is a namespace-type dict from which the tool is initialized.
      It should contain exactly one value that is a `Multitool` subclass, and
      this subclass will be instantiated and populated (see
      `Multitool.populate()`) using the other items in the namespace. Instances
      and subclasses of `Command` will therefore be registered with the
      `Multitool`. The tool is then invoked.
  
      `pwkit.cli.propagate_sigint()` and `pwkit.cli.unicode_stdio()` are called
      at the start of this function. It should therefore be only called immediately
      upon startup of the Python interpreter.
  
      This function always exits with an exception. The exception will be
      SystemExit (0) in case of success.
  
      The intended invocation is `invoke_tool (globals ())` in some module that
      defines a `Multitool` subclass and multiple `Command` subclasses.
  
      If `tool_class` is not None, this is used as the tool class rather than
      searching `namespace`, potentially avoiding problems with modules
      containing multiple `Multitool` implementations.
  
      """
      import sys
      from .. import cli
      cli.propagate_sigint ()
      cli.unicode_stdio ()
      cli.backtrace_on_usr1 ()
  
      if tool_class is None:
          for value in itervalues (namespace):
              if is_strict_subclass (value, Multitool):
                  if tool_class is not None:
                      raise PKError ('do not know which Multitool implementation to use')
                  tool_class = value
  
      if tool_class is None:
          raise PKError ('no Multitool implementation to use')
  
      tool = tool_class ()
      tool.populate (itervalues (namespace))
      tool.commandline (sys.argv)