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 _write_headers(self, msg):
      for h, v in msg.items():
          print >> self._fp, "%s:" % h,
          if self._maxheaderlen == 0:
              # Explicit no-wrapping
              print >> self._fp, v
          elif isinstance(v, Header):
              # Header instances know what to do
              print >> self._fp, v.encode()
          elif _is8bitstring(v):
              # If we have raw 8bit data in a byte string, we have no idea
              # what the encoding is.  There is no safe way to split this
              # string.  If it's ascii-subset, then we could do a normal
              # ascii split, but if it's multibyte then we could break the
              # string.  There's no way to know so the least harm seems to
              # be to not split the string and risk it being too long.
              print >> self._fp, v
          else:
              # Header's got lots of smarts, so use it.  Note that this is
              # fundamentally broken though because we lose idempotency when
              # the header string is continued with tabs.  It will now be
              # continued with spaces.  This was reversedly broken before we
              # fixed bug 1974.  Either way, we lose.
              print >> self._fp, Header(
                  v, maxlinelen=self._maxheaderlen, header_name=h
              ).encode()
      # A blank line always separates headers from body
      print >> self._fp
  
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 7 for calling the Generator obj's underlying member method code with example usage: obj._write_headers(msg) without return types