def _prepareForArgumentParser(self, task_cls):
        name = task_cls._loptName(self.name)

        # This is kinda funky.  I want to support some form of shorthand
        # notation for overridable default values.  Doing it this way means we
        # can do option(..., default=lambda cls: cls.FOO, ...)
        default = self.default
        if callable(default):
            default = default(task_cls)

        kwargs = dict(default=default, help=self.help, action=self.action,
                      required=self.required)
        if self.action is None:
            kwargs['metavar'] = self.metavar
            kwargs['type'] = self.type
            kwargs['choices'] = self.choices
        if self.nargs is not None:
            kwargs['nargs'] = self.nargs
        return _AddArgArgs([name], kwargs)
Convert inst properties to *args, **kwargs for ap.add_argument().
dataset/ETHPy150Open facebook/sparts/sparts/sparts.py/option._prepareForArgumentParser