code: def write(self, text):
          
  
          if self.disabled:
              self.write_with_encoding(self.encoding, text)
              return
  
          # See how far we can go into the text with the current encoding
          to_write, text = split_writable_text(self.encoder, text, self.encoding)
          if to_write:
              self.write_with_encoding(self.encoding, to_write)
  
          while text:
              # See if any of the code pages that the printer profile
              # supports can encode this character.
              encoding = self.encoder.find_suitable_encoding(text[0])
              if not encoding:
                  self._handle_character_failed(text[0])
                  text = text[1:]
                  continue
  
              # Write as much text as possible with the encoding found.
              to_write, text = split_writable_text(self.encoder, text, encoding)
              if to_write:
                  self.write_with_encoding(encoding, to_write)
docs: Write the text, automatically switching encodings.