code: def _get_suggestion(
      architectures,
      blocks_to_use,
      losses,
      grow=False,
      remove_outliers=False,
      pass_flatten=False,
  ):
      """Testing subroutine to handle boilerplate Trial construction, dirs, etc."""
  
      # TODO(b/172564129): Figure out how to use mock decorator for free functions.
      with mock.patch(
          "model_search.architecture"
          ".architecture_utils.get_architecture"
      ) as mock_get_arch:
          blocks_strs = [
              block_builder.BlockType(b).name for b in blocks_to_use
          ]
          spec = search_test_utils.create_spec(
              phoenix_spec_pb2.PhoenixSpec.CNN,
              blocks_to_use=blocks_strs,
          )
          spec.search_type = phoenix_spec_pb2.PhoenixSpec.LINEAR_MODEL
          spec.increase_complexity_probability = 1.0 if grow else 0.0
          spec.linear_model.remove_outliers = remove_outliers
          spec.linear_model.trials_before_fit = 1
          algorithm = linear_model.LinearModel(spec)
  
          mock_get_arch.side_effect = lambda idx: architectures[
              int(idx)
          ]
  
          trials = []
          for i, loss in enumerate(losses):
              if isinstance(loss, (np.floating, np.integer)):
                  loss = loss.item()
              trials.append(
                  trial_module.Trial(
                      {
                          "id": i,
                          "model_dir": str(i),
                          "status": "COMPLETED",
                          "trial_infeasible": False,
                          "final_measurement": {
                              "objective_value": loss
                          },
                      }
                  )
              )
  
          hparams = hp.HParams(new_block_type=NEW_BLOCK)
          # Second return val fork_trial is a nonsense concept for LinearModel.
          output_architecture, _ = algorithm.get_suggestion(
              trials, hparams
          )
          if not pass_flatten:
              output_architecture = np.array(
                  [
                      b
                      for b in output_architecture
                      if b not in block_builder.FLATTEN_TYPES
                  ]
              )
          return output_architecture
  
imports: from absl.testing import parameterized
  import mock
  from model_search import block_builder
  from model_search import hparam
  from model_search.metadata import trial
  from model_search.proto import phoenix_spec_pb2
  from model_search.search import linear_model
  from model_search.search import test_utils
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 1 for calling a global function with example usage: _get_suggestion(architectures, blocks_to_use, losses, grow, remove_outliers, pass_flatten) and returns: output_architecture