code: def header_encode(header_bytes, charset="iso-8859-1"):
      """Encode a single header line with quoted-printable (like) encoding.
  
      Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
      used specifically for email header fields to allow charsets with mostly 7
      bit characters (and some 8 bit) to remain more or less readable in non-RFC
      2045 aware mail clients.
  
      charset names the character set to use in the RFC 2046 header.  It
      defaults to iso-8859-1.
      """
      # Return empty headers as an empty string.
      if not header_bytes:
          return ""
      # Iterate over every byte, encoding if necessary.
      encoded = header_bytes.decode("latin1").translate(
          _QUOPRI_HEADER_MAP
      )
      # Now add the RFC chrome to each encoded chunk and glue the chunks
      # together.
      return "=?%s?q?%s?=" % (charset, encoded)
  
file_path: catboost/contrib/tools/python3/src/Lib/email/quoprimime.py
imports: import re
  from string import ascii_letters, digits, hexdigits
label_desc: Use image node_id 8 for calling a global function with example usage: header_encode(header_bytes, charset) and returns: unknown, str