code: def _has_custom_layer(spec):
      """
  
      Returns true if the given protobuf specification has a custom layer, and false otherwise.
  
      Parameters
      ----------
      spec: mlmodel spec
  
      Returns
      -------
  
      True if the protobuf specification contains a neural network with a custom layer, False otherwise.
  
      """
  
      layers = _get_nn_layers(spec)
      for layer in layers:
          if layer.WhichOneof("layer") == "custom":
              return True
  
      return False
  
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 20 for calling a global function with example usage: _has_custom_layer(spec) and returns: False, True