code: def filter_compiledir(path):
      # Expand '~' in path
      path = os.path.expanduser(path)
      # Turn path into the 'real' path. This ensures that:
      #   1. There is no relative path, which would fail e.g. when trying to
      #      import modules from the compile dir.
      #   2. The path is stable w.r.t. e.g. symlinks (which makes it easier
      #      to re-use compiled modules).
      path = os.path.realpath(path)
      if os.access(path, os.F_OK):  # Do it exist?
          if not os.access(path, os.R_OK | os.W_OK | os.X_OK):
              # If it exist we need read, write and listing access
              raise ValueError(
                  "compiledir '%s' exists but you don't have read, write"
                  " or listing permissions." % path
              )
      else:
          try:
              os.makedirs(
                  path, 0o770
              )  # read-write-execute for user and group
          except OSError as e:
              # Maybe another parallel execution of theano was trying to create
              # the same directory at the same time.
              if e.errno != errno.EEXIST:
                  raise ValueError(
                      "Unable to create the compiledir directory"
                      " '%s'. Check the permissions." % path
                  )
  
      # PROBLEM: sometimes the initial approach based on
      # os.system('touch') returned -1 for an unknown reason; the
      # alternate approach here worked in all cases... it was weird.
      # No error should happen as we checked the permissions.
      init_file = os.path.join(path, "__init__.py")
      if not os.path.exists(init_file):
          try:
              open(init_file, "w").close()
          except IOError as e:
              if os.path.exists(init_file):
                  pass  # has already been created
              else:
                  e.args += (
                      "%s exist? %s" % (path, os.path.exists(path)),
                  )
                  raise
      return path
  
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 28 for calling a global function with example usage: filter_compiledir(path) and returns: path