def _Base64EncodeAttachments(mime_message):
 for item in mime_message.get_payload():
  if ((item.get_content_maintype() not in ['multipart', 'text']) and ('Content-Transfer-Encoding' not in item)):
   encoders.encode_base64(item)

def _Base64EncodeAttachments ( mime_message ) : for item in mime_message . get_payload ( ) : if ( ( item . get_content_maintype ( ) not in [ 'multipart' , 'text' ] ) and ( 'Content-Transfer-Encoding' not in item ) ) : encoders . encode_base64 ( item )
base64 encode all individual attachments that are not text .