parameters: (fp, lineno)
return_statement: return caps, lineno
docstring: Read a mailcap file and return a dictionary keyed by MIME type.
  
      Each MIME type is mapped to an entry consisting of a list of
      dictionaries; the list will contain more than one such dictionary
      if a given MIME type appears more than once in the mailcap file.
      Each dictionary contains key-value pairs for that MIME type, where
      the viewing command is stored with the key "view".
docstring_summary: Read a mailcap file and return a dictionary keyed by MIME type.
docstring_tokens: Read a mailcap file and return a dictionary keyed by MIME type .
function: def _readmailcapfile(fp, lineno):
      """Read a mailcap file and return a dictionary keyed by MIME type.
  
      Each MIME type is mapped to an entry consisting of a list of
      dictionaries; the list will contain more than one such dictionary
      if a given MIME type appears more than once in the mailcap file.
      Each dictionary contains key-value pairs for that MIME type, where
      the viewing command is stored with the key "view".
      """
      caps = {}
      while 1:
          line = fp.readline()
          if not line: break
          # Ignore comments and blank lines
          if line[0] == '#' or line.strip() == '':
              continue
          nextline = line
          # Join continuation lines
          while nextline[-2:] == '\\\n':
              nextline = fp.readline()
              if not nextline: nextline = '\n'
              line = line[:-2] + nextline
          # Parse the line
          key, fields = parseline(line)
          if not (key and fields):
              continue
          if lineno is not None:
              fields['lineno'] = lineno
              lineno += 1
          # Normalize the key
          types = key.split('/')
          for j in range(len(types)):
              types[j] = types[j].strip()
          key = '/'.join(types).lower()
          # Update the database
          if key in caps:
              caps[key].append(fields)
          else:
              caps[key] = [fields]
      return caps, lineno
function_tokens: def _readmailcapfile ( fp , lineno ) : caps = { } while 1 : line = fp . readline ( ) if not line : break # Ignore comments and blank lines if line [ 0 ] == '#' or line . strip ( ) == '' : continue nextline = line # Join continuation lines while nextline [ - 2 : ] == '\\\n' : nextline = fp . readline ( ) if not nextline : nextline = '\n' line = line [ : - 2 ] + nextline # Parse the line key , fields = parseline ( line ) if not ( key and fields ) : continue if lineno is not None : fields [ 'lineno' ] = lineno lineno += 1 # Normalize the key types = key . split ( '/' ) for j in range ( len ( types ) ) : types [ j ] = types [ j ] . strip ( ) key = '/' . join ( types ) . lower ( ) # Update the database if key in caps : caps [ key ] . append ( fields ) else : caps [ key ] = [ fields ] return caps , lineno