code: def find_comments(fname, ch):
      
      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
docs: Find the comments for a function.
  
      fname: filename
      ch: CppHeaderParser parse tree
  
      The function must look like
      /*
       * comments
       * comments
       */
       template<class I, ...>
       void somefunc(...){
  
       -or-
  
      /*
       * comments
       * comments
       */
       void somefunc(...){
  
       -or-
  
      with // style comments
  
      Then, take off the first three spaces