code: def test_py2_version_deprecated(sagemaker_session):
      with pytest.raises(AttributeError) as e:
          _build_tf(
              sagemaker_session,
              framework_version="2.1.2",
              py_version="py2",
          )
  
      msg = (
          "Python 2 containers are only available with 2.1.1 and lower versions. "
          "Please use a Python 3 container."
      )
      assert msg in str(e.value)
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/tensorflow/test_estimator_init.py
imports: from __future__ import absolute_import
  from mock import Mock, patch
  from packaging import version
  import pytest
  from sagemaker.tensorflow import TensorFlow
label_desc: Use image node_id 4 for calling a global function with example usage: test_py2_version_deprecated(sagemaker_session) without return types