code: def _get_nn_layers(spec):
      
  
      layers = []
      if spec.WhichOneof('Type') == 'pipeline':
          layers = []
          for model_spec in spec.pipeline.models:
              if not layers:
                  return _get_nn_layers(model_spec)
              else:
                  layers.extend(_get_nn_layers(model_spec))
  
      elif spec.WhichOneof('Type') in ['pipelineClassifier',
                                          'pipelineRegressor']:
          layers = []
          for model_spec in spec.pipeline.models:
              if not layers:
                  return _get_nn_layers(model_spec)
              else:
                  layers.extend(_get_nn_layers(model_spec))
  
      elif spec.neuralNetwork.layers:
          layers = spec.neuralNetwork.layers
      elif spec.neuralNetworkClassifier.layers:
          layers = spec.neuralNetworkClassifier.layers
      elif spec.neuralNetworkRegressor.layers:
          layers = spec.neuralNetworkRegressor.layers
  
      return layers
docs: Returns a list of neural network layers if the model contains any.
  
      Parameters
      ----------
      spec: Model_pb
          A model protobuf specification.
  
      Returns
      -------
      [NN layer]
          list of all layers (including layers from elements of a pipeline