code: def _get_nn_spec(spec):
      if spec.WhichOneof("Type") == "neuralNetwork":
          nn_spec = spec.neuralNetwork
      elif spec.WhichOneof("Type") == "neuralNetworkClassifier":
          nn_spec = spec.neuralNetworkClassifier
      elif spec.WhichOneof("Type") == "neuralNetworkRegressor":
          nn_spec = spec.neuralNetworkRegressor
      else:
          raise ValueError(
              "Specification must contain a neural network"
          )
      return nn_spec
  
file_path: coremltools/coremltools/converters/mil/backend/nn/passes/mlmodel_passes.py
label_desc: Use image node_id 1 for calling a global function with example usage: _get_nn_spec(spec) and returns: nn_spec