code: def get_list_of_wedge_layer_modifiers(
      nn,
      num_modifications="all",
      internal_layer_type_candidates=None,
      choose_pool_with_prob=0.05,
      choose_stride_2_with_prob=0.05,
  ):
      """Returns a list of operations for adding a layer in between two layers."""
  
      # A local function for creating a modifier
      def _get_wedge_modifier(
          _layer_type, _num_units, _edge, _nl_attributes
      ):
          """Returns a modifier which wedges an edge between the edge."""
          return lambda arg_nn: wedge_layer(
              arg_nn,
              _layer_type,
              _num_units,
              _edge[0],
              _edge[1],
              _nl_attributes,
          )
  
      # Pre-process arguments
      nn_is_a_cnn = nn.nn_class == "cnn"
      if internal_layer_type_candidates is None:
          if nn_is_a_cnn:
              internal_layer_type_candidates = (
                  _DFLT_WEDGE_LAYER_CNN_CANDIDATES
              )
          else:
              internal_layer_type_candidates = (
                  _DFLT_WEDGE_LAYER_MLP_CANDIDATES
              )
      if not nn_is_a_cnn:
          choose_pool_with_prob = 0
      all_edges = nn.get_edges()
      num_modifications = (
          len(all_edges)
          if num_modifications == "all"
          else num_modifications
      )
      op_layer_idx = nn.get_op_layer_idx()  # Output layer
      ip_layer_idx = nn.get_ip_layer_idx()  # Input layer
      # We won't change this below so keep it as it is
      nonconv_nl_attrs = Namespace(stride=None)
      conv_nl_attrs_w_stride_1 = Namespace(stride=1)
      conv_nl_attrs_w_stride_2 = Namespace(stride=2)
      # Iterate through all edges
      ret = []
      for edge in all_edges:
          curr_layer_type = None
          # First handle the edges cases
          if edge[1] == op_layer_idx:
              continue
          elif nn_is_a_cnn and nn.layer_labels[edge[0]] == "fc":
              curr_layer_type = "fc"
              curr_num_units = nn.num_units_in_each_layer[edge[0]]
              nl_attrs = nonconv_nl_attrs
          elif not nn_is_a_cnn and edge[1] == op_layer_idx:
              # Don't add new layers just before the output for MLPs
              continue
          elif edge[0] == ip_layer_idx and nn_is_a_cnn:
              curr_pool_prob = (
                  0  # No pooling layer right after the input for a CNN
              )
          else:
              curr_pool_prob = choose_pool_with_prob
  
          if curr_layer_type is None:
              if np.random.random() < curr_pool_prob:
                  curr_layer_candidates = ["avg-pool", "max-pool"]
              else:
                  curr_layer_candidates = internal_layer_type_candidates
              curr_layer_type = np.random.choice(
                  curr_layer_candidates, 1
              )[0]
              if curr_layer_type in [
                  "max-pool",
                  "avg-pool",
                  "linear",
                  "softmax",
              ]:
                  curr_num_units = None
              else:
                  curr_num_units = _determine_num_units_for_wedge_layer(
                      nn, edge
                  )
              # Determine stride
              if is_a_conv_layer_label(curr_layer_type):
                  nl_attrs = (
                      conv_nl_attrs_w_stride_2
                      if np.random.random() < choose_stride_2_with_prob
                      else conv_nl_attrs_w_stride_1
                  )
              else:
                  nl_attrs = nonconv_nl_attrs
          ret.append(
              _get_wedge_modifier(
                  curr_layer_type, curr_num_units, edge, nl_attrs
              )
          )
          # Break if more than the number of modifications
          if len(ret) >= num_modifications:
              break
      return ret
  
imports: from argparse import Namespace
  from copy import deepcopy
  import numpy
  from .neural_network import ConvNeuralNetwork, MultiLayerPerceptron, MLP_RECTIFIERS, MLP_SIGMOIDS, is_a_pooling_layer_label, is_a_conv_layer_label, CNNImageSizeMismatchException, CNNNoConvAfterIPException
  from ..utils.general_utils import reorder_list_or_array, reorder_rows_and_cols_in_matrix
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 7 for calling a global function with example usage: get_list_of_wedge_layer_modifiers(nn, num_modifications, internal_layer_type_candidates, choose_pool_with_prob, choose_stride_2_with_prob) and returns: ret, function