def parse_multipart_files(request):
 (_, pdict) = cgi.parse_header(request.headers[u'Content-Type'])
 buf = BytesIO()
 buf.write(request.body)
 buf.seek(0)
 data = cgi.parse_multipart(buf, pdict)
 (_, filedata) = data.popitem()
 buf.close()
 buf = BytesIO()
 buf.write(u''.join(filedata))
 buf.seek(0)
 return buf

def parse_multipart_files ( request ) : ( _ , pdict ) = cgi . parse_header ( request . headers [ u'Content-Type' ] ) buf = BytesIO ( ) buf . write ( request . body ) buf . seek ( 0 ) data = cgi . parse_multipart ( buf , pdict ) ( _ , filedata ) = data . popitem ( ) buf . close ( ) buf = BytesIO ( ) buf . write ( u'' . join ( filedata ) ) buf . seek ( 0 ) return buf
given a prepared reqest .