def _get_upload_content(field_storage):
 message = email.message.Message()
 message.add_header('content-transfer-encoding', field_storage.headers.getheader('Content-Transfer-Encoding', ''))
 message.set_payload(field_storage.file.read())
 payload = message.get_payload(decode=True)
 return email.message_from_string(payload)

def _get_upload_content ( field_storage ) : message = email . message . Message ( ) message . add_header ( 'content-transfer-encoding' , field_storage . headers . getheader ( 'Content-Transfer-Encoding' , '' ) ) message . set_payload ( field_storage . file . read ( ) ) payload = message . get_payload ( decode = True ) return email . message_from_string ( payload )
returns an email .