<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_parser(self, func=None, name=None, **kwargs):
 """Add parser. This method makes a new sub command parser. It takes same arguments as add_parser() of the action class made by argparse.ArgumentParser.add_subparsers. In addition to, it takes one positional argument `func`, which is the function implements process of this sub command. The `func` will be used to determine the name, help, and description of this sub command. The function `func` will also be set as a default value of `cmd` attribute. If you want to choose name of this sub command, use keyword argument `name`. Args: func: function implements the process of this command. name: name of this command. If not give, the function name is used. Returns: new ArgumentParser object. Raises: ValueError: if the given function does not have docstrings. """

        if func:
            if not func.__doc__:
                raise ValueError(
                    "No docstrings given in {0}".format(func.__name__))

            info = _parse_doc(func.__doc__)
            if _HELP not in kwargs or not kwargs[_HELP]:
                kwargs[_HELP] = info["headline"]
            if _DESCRIPTION not in kwargs or not kwargs[_DESCRIPTION]:
                kwargs[_DESCRIPTION] = info["description"]
            if _FORMAT_CLASS not in kwargs or not kwargs[_FORMAT_CLASS]:
                kwargs[_FORMAT_CLASS] = argparse.RawTextHelpFormatter

            if not name:
                name = func.__name__ if hasattr(func, "__name__") else func

            res = self.__delegate.add_parser(name, argmap=info["args"], **kwargs)
            res.set_defaults(cmd=func)

        else:
            res = self.__delegate.add_parser(name, **kwargs)

        return res