Parse a docstring.

    Parse a docstring and extract three components; headline, description,
    and map of arguments to help texts.

    Args:
      doc: docstring.

    Returns:
      a dictionary.

def _parse_doc(doc):
    """Parse a docstring.

    Parse a docstring and extract three components; headline, description,
    and map of arguments to help texts.

    Args:
      doc: docstring.

    Returns:
      a dictionary.
    """
    lines = doc.split("\n")
    descriptions = list(itertools.takewhile(_checker(_KEYWORDS), lines))

    if len(descriptions) < 3:
        description = lines[0]
    else:
        description = "{0}\n\n{1}".format(
            lines[0], textwrap.dedent("\n".join(descriptions[2:])))

    args = list(itertools.takewhile(
        _checker(_KEYWORDS_OTHERS),
        itertools.dropwhile(_checker(_KEYWORDS_ARGS), lines)))
    argmap = {}
    if len(args) > 1:
        for pair in args[1:]:
            kv = [v.strip() for v in pair.split(":")]
            if len(kv) >= 2:
                argmap[kv[0]] = ":".join(kv[1:])

    return dict(headline=descriptions[0], description=description, args=argmap)