def CheckValidUTF8(string, desc):
  """Check that the given string is valid UTF-8.

  Args:
    string: the string to validate.
    desc: a description of the string being validated.

  Raises:
    apiproxy_errors.ApplicationError: if the string is not valid UTF-8.
  """

  if isinstance(string, unicode):
    return True
  try:
    string.decode('utf-8')
  except UnicodeDecodeError:
    Check(False, desc % '%s is not valid UTF-8.')
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py/CheckValidUTF8/swapped operands of `%`