code: def test_serve_local_code(tmpdir, sagemaker_session):
      with patch(
          "sagemaker.local.image._SageMakerContainer._create_tmp_folder",
          return_value=str(tmpdir.mkdir("container-root")),
      ):
          image = "my-image"
          sagemaker_container = _SageMakerContainer(
              "local", 1, image, sagemaker_session=sagemaker_session
          )
          environment = {
              "env1": 1,
              "env2": "b",
              "SAGEMAKER_SUBMIT_DIRECTORY": "file:///tmp/code",
          }
  
          sagemaker_container.serve("/some/model/path", environment)
          docker_compose_file = os.path.join(
              sagemaker_container.container_root, "docker-compose.yaml"
          )
  
          with open(docker_compose_file, "r") as f:
              config = yaml.load(f, Loader=yaml.SafeLoader)
  
              for h in sagemaker_container.hosts:
                  assert config["services"][h]["image"] == image
                  assert config["services"][h]["command"] == "serve"
  
                  volumes = config["services"][h]["volumes"]
                  volumes = [
                      v[:-2] if v.endswith(":z") else v for v in volumes
                  ]
                  assert "%s:/opt/ml/code" % "/tmp/code" in volumes
                  assert (
                      "SAGEMAKER_SUBMIT_DIRECTORY=/opt/ml/code"
                      in config["services"][h]["environment"]
                  )
  
imports: from __future__ import absolute_import
  import random
  import string
  from botocore.credentials import Credentials
  import base64
  import logging
  import json
  import os
  import subprocess
  import tarfile
  import pytest
  import yaml
  from mock import patch, Mock, MagicMock, mock_open, call
  import sagemaker
  from sagemaker.local.image import _SageMakerContainer, _Volume, _aws_credentials
  from sagemaker.local.utils import STUDIO_APP_TYPES
label_desc: Use image node_id 26 for calling a global function with example usage: test_serve_local_code(tmpdir, sagemaker_session) without return types