code: def _make_sliced_model(model, stop_layer):
      layers = OrderedDict()
      for name, layer in model.named_children():
          layers[name] = layer
          if name == stop_layer:
              break
      new_model = torch.nn.Sequential(layers)
      return new_model
  
imports: import contextlib
  import functools
  import operator
  import os
  import pkgutil
  import platform
  import sys
  import warnings
  from collections import OrderedDict
  from tempfile import TemporaryDirectory
  from typing import Any
  import pytest
  import torch
  import torch.fx
  import torch.nn
  from _utils_internal import get_relative_path
  from common_utils import cpu_and_cuda, freeze_rng_state, map_nested_tensor_object, needs_cuda, set_rng_seed
  from PIL import Image
  from torchvision import models, transforms
  from torchvision.models import get_model_builder, list_models
label_desc: Use image node_id 10 for calling a global function with example usage: _make_sliced_model(model, stop_layer) and returns: new_model