code: def test_badoptimization():
      @gof.local_optimizer([theano.tensor.add])
      def insert_broken_add(node):
          if node.op == theano.tensor.add:
              return [off_by_half(*node.inputs)]
          return False
  
      edb = gof.EquilibriumDB()
      edb.register("insert_broken_add", insert_broken_add, "all")
      opt = edb.query("+all")
  
      a = theano.tensor.dvector()
      b = theano.tensor.dvector()
  
      f = theano.function(
          [a, b], a + b, mode=debugmode.DebugMode(optimizer=opt)
      )
  
      try:
          f(
              [1.0, 2.0, 3.0],
              [2, 3, 4],
          )
      except debugmode.BadOptimization as e:
          assert str(e.reason) == "insert_broken_add"
          return  # TEST PASS
  
      assert False
  
imports: from __future__ import absolute_import, print_function, division
  import sys
  import unittest
  from nose.plugins.skip import SkipTest
  import numpy
  from six import reraise
  from theano import config
  from theano import gof
  import theano
  from theano.compat import exc_message
  from theano.compile import debugmode
  import theano.tensor
  from theano.tests import unittest_tools
label_desc: Use image node_id 3 for calling a global function with example usage: test_badoptimization() and returns: False, list