code: def run_orig_vs_modifications(
      save_dir,
      save_prefix,
      old_nn,
      get_modifications,
      constraint_checker,
      write_result,
  ):
      """Tests for the original network and the modifications. Also, visualises the networks."""
      visualise_nn(
          old_nn, os.path.join(save_dir, "%s_orig" % (save_prefix))
      )
      old_nn_copy = deepcopy(old_nn)
      # Get the modified networks.
      new_nns = get_modifications(old_nn)
      # Go through each new network.
      for new_idx, new_nn in enumerate(new_nns):
          assert isinstance(new_nn, NeuralNetwork)
          assert constraint_checker(new_nn)
          visualise_nn(
              new_nn,
              os.path.join(save_dir, "%s_%d" % (save_prefix, new_idx)),
          )
      # Finally test if the networks have not changed.
      assert networks_are_equal_are_equal(old_nn, old_nn_copy)
      write_result(
          "%s (%s):: #new-networks: %d."
          % (save_prefix, old_nn.nn_class, len(new_nns)),
          "test_result",
      )
  
imports: from copy import deepcopy
  import numpy
  import os
  from shutil import rmtree
  import unittest
  from .None import nn_domains
  from .None import nn_modifiers
  from .neural_network import NeuralNetwork
  from .nn_visualise import visualise_nn
  from .unittest_neural_network import generate_cnn_architectures, generate_mlp_architectures
  from ..utils.base_test_class import BaseTestClass, execute_tests
label_desc: Use image node_id 2 for calling a global function with example usage: run_orig_vs_modifications(save_dir, save_prefix, old_nn, get_modifications, constraint_checker, write_result) without return types