def get_task_parser(task):
args, varargs, keywords, defaults = inspect.getargspec(task)<EOL>defaults = defaults or []<EOL>parser = argparse.ArgumentParser(<EOL>prog='<STR_LIT>' + task.__name__,<EOL>add_help=False,<EOL>description=task.__doc__,<EOL>formatter_class=argparse.ArgumentDefaultsHelpFormatter<EOL>)<EOL>posargslen = len(args) - len(defaults)<EOL>if varargs is None and keywords is None:<EOL><INDENT>for idx, arg in enumerate(args):<EOL><INDENT>if idx < posargslen:<EOL><INDENT>parser.add_argument(arg)<EOL><DEDENT>else:<EOL><INDENT>default = defaults[idx - posargslen]<EOL>parser.add_argument('<STR_LIT>' + arg, default=default)<EOL><DEDENT><DEDENT>return parser, False<EOL><DEDENT>elif not args and varargs and not keywords and not defaults:<EOL><INDENT>return parser, True<EOL><DEDENT>else:<EOL><INDENT>raise InvalidTask(ERRMSG_UNSUPPORTED_SIG % task.__name__)<EOL><DEDENT>
Construct an ArgumentParser for the given task.

This function returns a tuple (parser, proxy_args).
If task accepts varargs only, proxy_args is True.
If task accepts only positional and explicit keyword args,
proxy args is False.