code: def _wrap_callback_args(f, docstring=None):  # pragma: no cover
      
      def wrapped(checked, *args):
          if args:
              return f(*args)
          if isinstance(f, partial):
              argspec = inspect.getargspec(f.func)
          else:
              argspec = inspect.getargspec(f)
          f_args = argspec.args
          if 'self' in f_args:
              f_args.remove('self')
          # Remove arguments with defaults from the list.
          if len(argspec.defaults or ()):
              f_args = f_args[:-len(argspec.defaults)]
          # Remove arguments supplied in a partial.
          if isinstance(f, partial):
              f_args = f_args[len(f.args):]
              f_args = [arg for arg in f_args if arg not in f.keywords]
          # If there are no remaining args, we can just run the fu nction.
          if not f_args:
              return f()
          # There are args, need to display the dialog.
          # Extract Example: `...` in the docstring to put a predefined text
          # in the input dialog.
          r = re.search('Example: `([^`]+)`', docstring)
          docstring_ = docstring[:r.start()].strip() if r else docstring
          text = r.group(1) if r else None
          s, ok = _input_dialog(getattr(f, '__name__', 'action'),
                                docstring_, text)
          if not ok or not s:
              return
          # Parse user-supplied arguments and call the function.
          args = _parse_snippet(s)
          return f(*args)
      return wrapped
docs: Display a Qt dialog when a function has arguments.
  
      The user can write function arguments as if it was a snippet.