code: def split_writable_text(encoder, text, encoding):
      
      if not encoding:
          return None, text
  
      for idx, char in enumerate(text):
          if encoder.can_encode(encoding, char):
              continue
          return text[:idx], text[idx:]
  
      return text, None
docs: Splits off as many characters from the begnning of text as
      are writable with "encoding". Returns a 2-tuple (writable, rest).