human
Complete this python program:
def _parse_function_doc(doc):
assistant
#Here is the Python program you requested.

    """Takes a function and returns the params and return value as a tuple.
    This is nothing more than a docstring parser.
    TODO docstrings like utime(path, (atime, mtime)) and a(b [, b]) -> None
    TODO docstrings like \tuple of integers\
    """
    try:
        count = 0
        start = doc.index('(')
        for (i, s) in enumerate(doc[start:]):
            if (s == '('):
                count += 1
            elif (s == ')'):
                count -= 1
            if (count == 0):
                end = (start + i)
                break
        param_str = doc[(start + 1):end]
    except (ValueError, UnboundLocalError):
        debug.dbg('no    brackets    found    -    no    param')
        end = 0
        param_str = ''
    else:
        def change_options(m):
            args = m.group(1).split(',')
            for (i, a) in enumerate(args):
                if (a and ('=' not in a)):
                    args[i] += '=None'
            return ','.join(args)
        while True:
            (param_str, changes) = re.subn('    ?\\[([^\\[\\]]+)\\]', change_options, param_str)
            if (changes == 0):
                break
    param_str = param_str.replace('-', '_')
    r = re.search('-[>-]*    ', doc[end:(end + 7)])
    if (r is None):
        ret = ''
    else:
        index = (end + r.end())
        pattern = re.compile('(,\\n|[^\\n-])+')
        ret_str = pattern.match(doc, index).group(0).strip()
        ret_str = re.sub('[nN]ew    (.*)', '\\1()', ret_str)
        ret = docstr_defaults.get(ret_str, ret_str)
    return (param_str, ret)