code: def as_string(self, unixfrom=False, maxheaderlen=0):
          
          from future.backports.email.generator import Generator
          fp = StringIO()
          g = Generator(fp, mangle_from_=False, maxheaderlen=maxheaderlen)
          g.flatten(self, unixfrom=unixfrom)
          return fp.getvalue()
docs: Return the entire formatted message as a (unicode) string.
          Optional `unixfrom' when True, means include the Unix From_ envelope
          header.
  
          This is a convenience method and may not generate the message exactly
          as you intend.  For more flexibility, use the flatten() method of a
          Generator instance.