def maybe_multipart_byteranges_to_document_iters(app_iter, content_type):
 (content_type, params_list) = parse_content_type(content_type)
 if (content_type != 'multipart/byteranges'):
  (yield app_iter)
  return
 body_file = FileLikeIter(app_iter)
 boundary = dict(params_list)['boundary']
 for (_headers, body) in mime_to_document_iters(body_file, boundary):
  (yield (chunk for chunk in iter((lambda : body.read(65536)), '')))

def maybe_multipart_byteranges_to_document_iters ( app_iter , content_type ) : ( content_type , params_list ) = parse_content_type ( content_type ) if ( content_type != 'multipart/byteranges' ) : ( yield app_iter ) return body_file = FileLikeIter ( app_iter ) boundary = dict ( params_list ) [ 'boundary' ] for ( _headers , body ) in mime_to_document_iters ( body_file , boundary ) : ( yield ( chunk for chunk in iter ( ( lambda : body . read ( 65536 ) ) , '' ) ) )
takes an iterator that may or may not contain a multipart mime document as well as content type and returns an iterator of body iterators .