code: def force_unicode(value):
      
      if IS_PY3:
          # Python 3.X
          if isinstance(value, bytes):
              value = value.decode('utf-8', errors='replace')
          elif not isinstance(value, str):
              value = str(value)
      else:
          # Python 2.X
          if isinstance(value, str):
              value = value.decode('utf-8', 'replace')
          elif not isinstance(value, basestring):  # NOQA: F821
              value = unicode(value)  # NOQA: F821
  
      return value
docs: Forces a bytestring to become a Unicode string.