code: def local_sigm_times_exp(node):
      """
      exp(x) * sigm(-x) -> sigm(x)
      exp(-x) * sigm(x) -> sigm(-x)
  
      todo: add stack traces to the intermediate variables
      """
      # Bail early if it is not a multiplication.
      if node.op != tensor.mul:
          return None
      # Obtain tree of multiplications starting at this node.
      mul_tree = parse_mul_tree(node.outputs[0])
      # Perform core optimization.
      did_something = perform_sigm_times_exp(mul_tree)
      if not did_something:
          # No change.
          return None
      # The optimization may have introduced multiplications by 1 in the tree:
      # get rid of them.
      mul_tree = simplify_mul(mul_tree)
      # Recompute final output based on the updated tree.
      out = compute_mul(mul_tree)
      # keep the stack trace
      copy_stack_trace(node.outputs[0], out)
      return [out]
  
imports: from __future__ import absolute_import, print_function, division
  import warnings
  import numpy
  import theano
  from theano import config, gof, printing, scalar
  from theano.compat import imap
  from theano.printing import pprint
  from theano.tensor import basic
  from theano.tensor import elemwise, opt, NotScalarConstantError
  from theano.tensor.type import values_eq_approx_remove_inf
  from theano.gof.opt import copy_stack_trace
label_desc: Use image node_id 17 for calling a global function with example usage: local_sigm_times_exp(node) and returns: list, None, None