code: def test_py2_xgboost_error(
      sagemaker_session, xgboost_framework_version
  ):
      with pytest.raises(ValueError) as error1:
          XGBoost(
              entry_point=SCRIPT_PATH,
              role=ROLE,
              framework_version=xgboost_framework_version,
              sagemaker_session=sagemaker_session,
              instance_type=INSTANCE_TYPE,
              instance_count=1,
              py_version="py2",
          )
  
      with pytest.raises(ValueError) as error2:
          model = XGBoostModel(
              model_data=DATA_DIR,
              role=ROLE,
              sagemaker_session=sagemaker_session,
              entry_point=SCRIPT_PATH,
              framework_version=xgboost_framework_version,
              py_version="py2",
          )
          model.serving_image_uri(REGION, INSTANCE_TYPE)
  
      error_message = "Unsupported Python version: py2."
      assert error_message in str(error1)
      assert error_message in str(error2)
  
imports: from __future__ import absolute_import
  import logging
  import json
  import os
  import pytest
  from mock import Mock
  from mock import patch
  from packaging.version import Version
  from sagemaker.fw_utils import UploadedCode
  from sagemaker.session_settings import SessionSettings
  from sagemaker.xgboost import XGBoost, XGBoostModel, XGBoostPredictor
label_desc: Use image node_id 19 for calling a global function with example usage: test_py2_xgboost_error(sagemaker_session, xgboost_framework_version) without return types