docs: def get_kwargs(self, args):
          """
          Given a Namespace object drawn from argparse, determines the
          keyword arguments to pass to the underlying function.  Note
          that, if the underlying function accepts all keyword
          arguments, the dictionary returned will contain the entire
          contents of the Namespace object.  Also note that an
          AttributeError will be raised if any argument required by the
          function is not set in the Namespace object.
  
          :param args: A Namespace object from argparse.
          """
  
          # Now we need to figure out which arguments the final function
          # actually needs
          kwargs = {}
          argspec = inspect.getargspec(self._func)
          required = set(argspec.args[:-len(argspec.defaults)]
                         if argspec.defaults else argspec.args)
          for arg_name in argspec.args:
              try:
                  kwargs[arg_name] = getattr(args, arg_name)
              except AttributeError:
                  if arg_name in required:
                      # If this happens, that's a programming failure
                      raise
  
          # If the function accepts any keyword argument, add whatever
          # remains
          if argspec.keywords:
              for key, value in args.__dict__.items():
                  if key in kwargs:
                      # Already handled
                      continue
                  kwargs[key] = value
  
          return kwargs