#NEWLINE# def multipart_form_encode( params , headers , boundary , quote = url_quote ) : #NEWLINE# #INDENT# 'Creates a tuple with MultipartForm instance as body and dict as headers\n\n    params\n      dict with fields for the body\n\n    headers\n      dict with fields for the header\n\n    boundary\n      string to use as boundary\n\n    quote (default: url_quote)\n      some callable expecting a string an returning a string. Use for quoting of\n      boundary and form-data keys (names).\n    ' #NEWLINE# headers = ( headers or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# boundary = quote ( boundary ) #NEWLINE# body = MultipartForm ( params , boundary , headers , quote = quote ) #NEWLINE# headers [ 'Content-Type' ] = ( 'multipart/form-data; boundary=%s' % boundary ) #NEWLINE# headers [ 'Content-Length' ] = str ( body . get_size ( ) ) #NEWLINE# return ( body , headers )