code: def unicode_safe (s, encoding=i18n.default_encoding, errors='replace'):
      
      assert s is not None, "argument to unicode_safe was None"
      if isinstance(s, unicode):
          # s is already unicode, nothing to do
          return s
      return unicode(str(s), encoding, errors)
docs: Get unicode string without raising encoding errors. Unknown
      characters of the given encoding will be ignored.
  
      @param s: the string to be decoded
      @type s: any object except None
      @return: if s is already unicode, return s unchanged; else return
          decoded unicode string of str(s)
      @rtype: unicode