class_docstr: Generates output from a Message object tree.
  
  This basic generator writes the message to the given file object as plain
  text.
class_docstr_tok: ["Generates","output","from","a","Message","object","tree",".","This","basic","generator","writes","the","message","to","the","given","file","object","as","plain","text","."]
code: def _handle_message_delivery_status(self, msg):
      # We can't just write the headers directly to self's file object
      # because this will leave an extra newline between the last header
      # block and the boundary.  Sigh.
      blocks = []
      for part in msg.get_payload():
          s = StringIO()
          g = self.clone(s)
          g.flatten(part, unixfrom=False)
          text = s.getvalue()
          lines = text.split("\n")
          # Strip off the unnecessary trailing empty line
          if lines and lines[-1] == "":
              blocks.append(NL.join(lines[:-1]))
          else:
              blocks.append(text)
      # Now join all the blocks with an empty line.  This has the lovely
      # effect of separating each block with an empty line, but not adding
      # an extra one after the last one.
      self._fp.write(NL.join(blocks))
  
imports: import re
  import sys
  import time
  import random
  import warnings
  from cStringIO import StringIO
  from email.header import Header
label_desc: Use image node_id 11 for calling the Generator obj's underlying member method code with example usage: obj._handle_message_delivery_status(msg) without return types