code: def validate_deprecation_semver(version_string, version_description):
    
    if version_string is None:
      raise MissingSemanticVersionError('The {} must be provided.'.format(version_description))
    if not isinstance(version_string, six.string_types):
      raise BadSemanticVersionError('The {} must be a version string.'.format(version_description))
    try:
      # NB: packaging will see versions like 1.a.0 as 1a0, and are "valid"
      # We explicitly want our versions to be of the form x.y.z.
      v = Version(version_string)
      if len(v.base_version.split('.')) != 3:
        raise BadSemanticVersionError('The given {} is not a valid version: '
                                     '{}'.format(version_description, version_string))
      if not v.is_prerelease:
        raise NonDevSemanticVersionError('The given {} is not a dev version: {}\n'
                                        'Features should generally be removed in the first `dev` release '
                                        'of a release cycle.'.format(version_description, version_string))
      return v
    except InvalidVersion as e:
      raise BadSemanticVersionError('The given {} {} is not a valid version: '
                                   '{}'.format(version_description, version_string, e))
docs: Validates that version_string is a valid semver.
  
    If so, returns that semver.  Raises an error otherwise.
  
    :param str version_string: A pantsbuild.pants version which affects some deprecated entity.
    :param str version_description: A string used in exception messages to describe what the
                                    `version_string` represents.
    :rtype: `packaging.version.Version`
    :raises DeprecationApplicationError: if the version_string parameter is invalid.