code: def filter_mode(val):
      if val in [
          "Mode",
          "DebugMode",
          "FAST_RUN",
          "NanGuardMode",
          "FAST_COMPILE",
          "DEBUG_MODE",
      ]:
          return val
      # This can be executed before Theano is completly imported, so
      # theano.Mode is not always available.
      elif hasattr(theano, "Mode") and isinstance(val, theano.Mode):
          return val
      else:
          raise ValueError(
              "Expected one of those string 'Mode', 'DebugMode',"
              " 'FAST_RUN', 'NanGuardMode', 'FAST_COMPILE',"
              " 'DEBUG_MODE' or an instance of Mode."
          )
  
imports: from __future__ import absolute_import, print_function, division
  import errno
  import os
  import sys
  import logging
  import numpy
  import platform
  import textwrap
  import re
  import socket
  import struct
  import warnings
  from six import string_types
  import theano
  from theano.configparser import AddConfigVar, BoolParam, ConfigParam, EnumStr, FloatParam, IntParam, StrParam, TheanoConfigParser, THEANO_FLAGS_DICT
  from theano.misc.cpucount import cpuCount
  from theano.misc.windows import call_subprocess_Popen, output_subprocess_Popen
  from theano.compat import maybe_add_to_os_environ_pathlist
label_desc: Use image node_id 12 for calling a global function with example usage: filter_mode(val) and returns: val, val