code: def test_estimator_py2_warning(
      warning, sagemaker_session, pytorch_training_version
  ):
      estimator = PyTorch(
          entry_point=SCRIPT_PATH,
          role=ROLE,
          sagemaker_session=sagemaker_session,
          instance_count=INSTANCE_COUNT,
          instance_type=INSTANCE_TYPE,
          framework_version=pytorch_training_version,
          py_version="py2",
      )
  
      assert estimator.py_version == "py2"
      warning.assert_called_with(
          estimator._framework_name, defaults.LATEST_PY2_VERSION
      )
  
imports: from __future__ import absolute_import
  import logging
  import json
  import os
  import pytest
  from mock import ANY, MagicMock, Mock, patch
  from packaging.version import Version
  from sagemaker import image_uris
  from sagemaker.pytorch import defaults
  from sagemaker.pytorch import PyTorch, PyTorchPredictor, PyTorchModel
  from sagemaker.instance_group import InstanceGroup
  from sagemaker.session_settings import SessionSettings
label_desc: Use image node_id 20 for calling a global function with example usage: test_estimator_py2_warning(warning, sagemaker_session, pytorch_training_version) without return types