def CheckInstalledVersion(name, desired, explicit):
  """Check that the installed version of a package is acceptable.

  Args:
    name: Name of package.
    desired: Desired version string.
    explicit: Explicitly requested by the user or implicitly because of a
      dependency.

  Raises:
    UnacceptableVersionError if the installed version of a package is
    unacceptable.
  """
  CallSetAllowedModule(name, desired)
  find_version = PACKAGES[name][0]
  if name == 'django':
    global _DESIRED_DJANGO_VERSION
    _DESIRED_DJANGO_VERSION = 'v' + desired.replace('.', '_')
  installed_version = find_version()
  try:
    desired_version = distutils.version.LooseVersion(desired)
  except __HOLE__:

    desired_version = LooseVersion.parse(desired)

  if not EqualVersions(installed_version, desired_version):
    raise UnacceptableVersionError(
        '%s %s was requested, but %s is already in use' %
        (name, desired_version, installed_version))
  installed[name] = desired, explicit
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/dist/_library.py/CheckInstalledVersion