def ValidateSourceReference(ref):
  """Determines if a source reference is valid.

  Args:
    ref: A source reference in a [repository_uri#]revision form.

  Raises:
    ValidationError: when the reference is malformed.
  """
  repo_revision = ref.split('#', 1)
  revision_id = repo_revision[-1]
  if not re.match(SOURCE_REVISION_RE_STRING, revision_id):
    raise validation.ValidationError('Bad revision identifier: %s' %
                                     revision_id)

  if len(repo_revision) == 2:
    uri = repo_revision[0]
    if not re.match(SOURCE_REPO_RE_STRING, uri):
      raise validation.ValidationError(uri % 'Bad repository URI: %s')
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/appinfo.py/ValidateSourceReference/swapped operands of `%`