def _DocToArgs(doc):
    """Converts a docstring documenting arguments into a dict."""
    m = None
    offset = None
    in_arg = False
    out = {}
    for l in doc.splitlines():
        if l.strip() == 'Args:':
            in_arg = True
        elif in_arg:
            if not l.strip():
                break
            if offset is None:
                offset = len(l) - len(l.lstrip())
            l = l[offset:]
            if l[0] == ' ' and m:
                out[m.group(1)] += ' ' + l.lstrip()
            else:
                m = re.match(r'^([a-z_]+): (.+)$', l.strip())
                out[m.group(1)] = m.group(2)
    return out
Converts a docstring documenting arguments into a dict.
adb/common_cli.py