code: def bytes_to_unicode(s, encoding='utf-8', errors='replace'):
      
      if compat.PY3:
          return str(s, 'utf-8') if isinstance(s, bytes) else s
      return s if isinstance(s, unicode) else s.decode(encoding, errors)
docs: Helper to convert byte string to unicode string for user based input
  
      :param str s: string to decode
      :param str encoding: utf-8 by default
      :param str errors: what to do when decoding fails
      :return: unicode utf-8 string