code: def _replace_custom_layer_name(spec, oldname, newname):
      """
  
      Substitutes newname for oldname in the className field of custom layers. If there are no custom layers, or no
      layers with className=oldname, then the spec is unchanged.
  
      Parameters
      ----------
      spec: mlmodel spec
  
      oldname: str The custom layer className to be replaced.
  
      newname: str The new className value to replace oldname
  
      Returns
      -------
  
      An mlmodel spec.
  
      """
      layers = _get_custom_layers(spec)
      for layer in layers:
          if layer.custom.className == oldname:
              layer.custom.className = newname
  
imports: from collections.abc import Iterable
  from functools import lru_cache
  import math
  import os
  import shutil
  import subprocess
  import sys
  import tempfile
  from typing import Optional, Union
  import warnings
  import numpy
  import coremltools
  from coremltools import ComputeUnit
  from coremltools.converters.mil.mil.passes.defs.preprocess import NameSanitizer
  from coremltools.proto import Model_pb2
  import coremltools.proto.MIL_pb2
  from .._deps import _HAS_SCIPY
label_desc: Use image node_id 23 for calling a global function with example usage: _replace_custom_layer_name(spec, oldname, newname) without return types