docs: def ensure_unicode(text):
      u"""helper to ensure that text passed to WriteConsoleW is unicode"""
      if isinstance(text, str):
          try:
              return text.decode(pyreadline_codepage, u"replace")
          except (LookupError, TypeError):
              return text.decode(u"ascii", u"replace")
      return text