def _validate_min_version(min_version):
  """Validates the extension version matches the requested version.

  Args:
    min_version: Minimum version passed as a query param when establishing the
      connection.

  Returns:
    An ExtensionVersionResult indicating validation status. If there is a
    problem, the error_reason field will be non-empty.
  """
  if min_version is not None:
    try:
      parsed_min_version = version.StrictVersion(min_version)
    except ValueError:
      return ExtensionVersionResult(
          error_reason=ExtensionValidationError.UNPARSEABLE_REQUESTED_VERSION,
          requested_extension_version=min_version)

    if parsed_min_version > HANDLER_VERSION:
      return ExtensionVersionResult(
          error_reason=ExtensionValidationError.OUTDATED_VERSION,
          requested_extension_version=str(parsed_min_version))

  return ExtensionVersionResult(
      error_reason=None, requested_extension_version=min_version)
Validates the extension version matches the requested version.

  Args:
    min_version: Minimum version passed as a query param when establishing the
      connection.

  Returns:
    An ExtensionVersionResult indicating validation status. If there is a
    problem, the error_reason field will be non-empty.