docs: def wash_for_utf8(text, correct=True):
      """Return UTF-8 encoded binary string with incorrect characters washed away.
  
      :param text: input string to wash (can be either a binary or Unicode string)
      :param correct: whether to correct bad characters or throw exception
      """
      if isinstance(text, unicode):
          return text.encode('utf-8')
  
      errors = "ignore" if correct else "strict"
      return text.decode("utf-8", errors).encode("utf-8", errors)