def mime_to_document_iters(input_file, boundary, read_chunk_size=4096):
 doc_files = iter_multipart_mime_documents(input_file, boundary, read_chunk_size)
 for (i, doc_file) in enumerate(doc_files):
  headers = parse_mime_headers(doc_file)
  (yield (headers, doc_file))

def mime_to_document_iters ( input_file , boundary , read_chunk_size = 4096 ) : doc_files = iter_multipart_mime_documents ( input_file , boundary , read_chunk_size ) for ( i , doc_file ) in enumerate ( doc_files ) : headers = parse_mime_headers ( doc_file ) ( yield ( headers , doc_file ) )
takes a file-like object containing a multipart mime document and returns an iterator of tuples .