<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_comments(fname, ch):
 """ Find the comments for a function. fname: filename ch: CppHeaderParser parse tree The function must look like /* * comments * comments */ -or- /* * comments * comments */ -or- with // style comments Then, take off the first three spaces """

    with open(fname, 'r') as inf:
        fdata = inf.readlines()

    comments = {}
    for f in ch.functions:
        lineno = f['line_number'] - 1  # zero based indexing

        # set starting position
        lineptr = lineno - 1
        if f['template']:
            lineptr -= 1
        start = lineptr

        # find the top of the comment block
        while fdata[lineptr].startswith('//') or\
            fdata[lineptr].startswith('/*') or\
                fdata[lineptr].startswith(' *'):
            lineptr -= 1
        lineptr += 1
        comment = fdata[lineptr:(start + 1)]
        comment = [c[3:].rstrip() for c in comment]
        comments[f['name']] = '\n'.join(comment).strip()

    return comments