def _write_headers(self, msg):
        for h, v in msg.items():
            # Determine if we are supposed to skip this header or not.
            #
            if (self._skip and h.lower() in self._headers) or \
               (not self._skip and h.lower() not in self._headers):
                continue

            # Otherwise output this header.
            #
            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.
                print >> self._fp, Header(
                    v, maxlinelen=self._maxheaderlen,
                    header_name=h, continuation_ws='\t').encode()
        # A blank line always separates headers from body
        print >> self._fp


############################################################################
#
dataset/ETHPy150Open scanner/asimap/asimap/fetch.py/HeaderGenerator._write_headers/original