code: def increase_structure_depth(
      previous_architecture, added_block, problem_type
  ):
      """Returns new structure given the old one and the added block.
  
      Increases the depth of the neural network by adding `added_block`.
      For the case of cnns, if the block is convolutional, it will add it before
      the flattening operation. Otherwise, if it is a dense block, then it will
      be added at the end.
      For the dnn and rnn case, the added_block is always added at the end.
  
      Args:
        previous_architecture: the input architecture. An np.array holding
          `block_builder.BlockType` (i.e., holding integers).
        added_block: a `block_builder.BlockType` to add to previous_architecture.
        problem_type: a `PhoenixSpec.ProblemType` enum.
  
      Returns:
        np.array of `block_builder.BlockType` (integers).
      """
      if added_block == block_builder.BlockType.EMPTY_BLOCK:
          return previous_architecture.copy()
      output = previous_architecture.copy()
  
      # No problems for DNN of RNN
      if problem_type != phoenix_spec_pb2.PhoenixSpec.CNN:
          return np.append(output, added_block)
  
      # TODO(b/172564129): Change this class (blocks) to a singleton
      blocks = block_builder.Blocks()
      # CNN case - convolution before fully connected.
      if not blocks[added_block].is_input_order_important:
          return np.append(output, added_block)
      # First block index in which order is not important
      index_for_new_block = next(
          index
          for index, block in enumerate(previous_architecture)
          if not blocks[block].is_input_order_important
      )
      return np.insert(output, index_for_new_block, added_block)
  
imports: import collections
  import os
  import string
  import time
  from absl import flags
  from absl import logging
  from model_search import block
  from model_search import block_builder
  from model_search import hparam
  from model_search import utils
  from model_search.proto import hparam_pb2
  from model_search.proto import phoenix_spec_pb2
  from model_search.proto import transfer_learning_spec_pb2
  import numpy
  import tensorflow.compat.v2
  import tf_slim
  from google.protobuf import text_format
label_desc: Use image node_id 13 for calling a global function with example usage: increase_structure_depth(previous_architecture, added_block, problem_type) and returns: np, previous_architecture, np, np