class_docstr: Generates output from a Message object tree.
  
  This basic generator writes the message to the given file object as plain
  text.
docstr: Print the message object tree rooted at msg to the output file
  specified when the Generator instance was created.
  
  unixfrom is a flag that forces the printing of a Unix From_ delimiter
  before the first object in the message tree.  If the original message
  has no From_ delimiter, a `standard' one is crafted.  By default, this
  is False to inhibit the printing of any From_ delimiter.
  
  Note that for subobjects, no From_ line is printed.
  
  linesep specifies the characters used to indicate a new line in
  the output.  The default value is determined by the policy specified
  when the Generator instance was created or, if none was specified,
  from the policy associated with the msg.
docstr_tok: ["Print","the","message","object","tree","rooted","at","msg","to","the","output","file","specified","when","the","Generator","instance","was","created",".","unixfrom","is","a","flag","that","forces","the","printing","of","a","Unix","From_","delimiter","before","the","first","object","in","the","message","tree",".","If","the","original","message","has","no","From_","delimiter",",","a","`","standard","'","one","is","crafted",".","By","default",",","this","is","False","to","inhibit","the","printing","of","any","From_","delimiter",".","Note","that","for","subobjects",",","no","From_","line","is","printed",".","linesep","specifies","the","characters","used","to","indicate","a","new","line","in","the","output",".","The","default","value","is","determined","by","the","policy","specified","when","the","Generator","instance","was","created","or",",","if","none","was","specified",",","from","the","policy","associated","with","the","msg","."]
code: def flatten(self, msg, unixfrom=False, linesep=None):
      r"""Print the message object tree rooted at msg to the output file
      specified when the Generator instance was created.
  
      unixfrom is a flag that forces the printing of a Unix From_ delimiter
      before the first object in the message tree.  If the original message
      has no From_ delimiter, a `standard' one is crafted.  By default, this
      is False to inhibit the printing of any From_ delimiter.
  
      Note that for subobjects, no From_ line is printed.
  
      linesep specifies the characters used to indicate a new line in
      the output.  The default value is determined by the policy specified
      when the Generator instance was created or, if none was specified,
      from the policy associated with the msg.
  
      """
      # We use the _XXX constants for operating on data that comes directly
      # from the msg, and _encoded_XXX constants for operating on data that
      # has already been converted (to bytes in the BytesGenerator) and
      # inserted into a temporary buffer.
      policy = msg.policy if self.policy is None else self.policy
      if linesep is not None:
          policy = policy.clone(linesep=linesep)
      if self.maxheaderlen is not None:
          policy = policy.clone(max_line_length=self.maxheaderlen)
      self._NL = policy.linesep
      self._encoded_NL = self._encode(self._NL)
      self._EMPTY = ""
      self._encoded_EMPTY = self._encode(self._EMPTY)
      # Because we use clone (below) when we recursively process message
      # subparts, and because clone uses the computed policy (not None),
      # submessages will automatically get set to the computed policy when
      # they are processed by this code.
      old_gen_policy = self.policy
      old_msg_policy = msg.policy
      try:
          self.policy = policy
          msg.policy = policy
          if unixfrom:
              ufrom = msg.get_unixfrom()
              if not ufrom:
                  ufrom = "From nobody " + time.ctime(time.time())
              self.write(ufrom + self._NL)
          self._write(msg)
      finally:
          self.policy = old_gen_policy
          msg.policy = old_msg_policy
  
imports: import re
  import sys
  import time
  import random
  from copy import deepcopy
  from io import StringIO, BytesIO
  from email.utils import _has_surrogates
label_desc: Use image node_id 3 for calling the Generator obj's underlying member method code with example usage: obj.flatten(msg, unixfrom, linesep) without return types