code: def _encode_chunks(self, newchunks, maxlinelen):
      # MIME-encode a header with many different charsets and/or encodings.
      #
      # Given a list of pairs (string, charset), return a MIME-encoded
      # string suitable for use in a header field.  Each pair may have
      # different charsets and/or encodings, and the resulting header will
      # accurately reflect each setting.
      #
      # Each encoding can be email.utils.QP (quoted-printable, for
      # ASCII-like character sets like iso-8859-1), email.utils.BASE64
      # (Base64, for non-ASCII like character sets like KOI8-R and
      # iso-2022-jp), or None (no encoding).
      #
      # Each pair will be represented on a separate line; the resulting
      # string will be in the format:
      #
      # =?charset1?q?Mar=EDa_Gonz=E1lez_Alonso?=\n
      #  =?charset2?b?SvxyZ2VuIEL2aW5n?="
      chunks = []
      for header, charset in newchunks:
          if not header:
              continue
          if charset is None or charset.header_encoding is None:
              s = header
          else:
              s = charset.header_encode(header)
          # Don't add more folding whitespace than necessary
          if chunks and chunks[-1].endswith(" "):
              extra = ""
          else:
              extra = " "
          _max_append(chunks, s, maxlinelen, extra)
      joiner = NL + self._continuation_ws
      return joiner.join(chunks)
  
imports: import re
  import binascii
  import email.quoprimime
  import email.base64mime
  from email.errors import HeaderParseError
  from email.charset import Charset
label_desc: Use image node_id 9 for calling the Header obj's underlying member method code with example usage: obj._encode_chunks(newchunks, maxlinelen) and returns: joiner