code: def _bytes_to_unicode(value):
      
      result = value.decode("utf-8") if isinstance(value, six.binary_type) else value
      if isinstance(result, six.text_type):
          return result
      else:
          raise ValueError("%r could not be converted to unicode" % (value,))
docs: Converts bytes to a unicode value, if necessary.
  
      :type value: bytes
      :param value: bytes value to attempt string conversion on.
  
      :rtype: str
      :returns: The original value converted to unicode (if bytes) or as passed
                in if it started out as unicode.
  
      :raises ValueError: if the value could not be converted to unicode.