code: def get_app_main_kwargs(self, kwargs, keep=False):
          
          if not keep:
              return {key: kwargs.pop(key) for key in list(kwargs)
                      if key in inspect.getargspec(self.app_main)[0]}
          else:
              return {key: kwargs[key] for key in list(kwargs)
                      if key in inspect.getargspec(self.app_main)[0]}
docs: Extract the keyword arguments for the :meth:`app_main` method
  
          Parameters
          ----------
          kwargs: dict
              A mapping containing keyword arguments for the :meth:`app_main`
              method
          keep: bool
              If True, the keywords are kept in the `kwargs`. Otherwise, they are
              removed
  
          Returns
          -------
          dict
              The keyword arguments for the :meth:`app_main` method
  
          Notes
          -----
          The returned keyword arguments are deleted from `kwargs`