code: def check(file):
      if os.path.isdir(file) and not os.path.islink(file):
          if verbose:
              print("listing directory", file)
          names = os.listdir(file)
          for name in names:
              fullname = os.path.join(file, name)
              if (
                  recurse
                  and os.path.isdir(fullname)
                  and not os.path.islink(fullname)
                  and not os.path.split(fullname)[1].startswith(".")
              ) or name.lower().endswith(".py"):
                  check(fullname)
          return
  
      if verbose:
          print("checking", file, "...", end=" ")
      try:
          f = open(file)
      except IOError as msg:
          errprint("%s: I/O Error: %s" % (file, str(msg)))
          return
  
      r = Reindenter(f)
      f.close()
      if r.run():
          if verbose:
              print("changed.")
              if dryrun:
                  print("But this is a dry run, so leaving it alone.")
          if not dryrun:
              bak = file + ".bak"
              if makebackup:
                  shutil.copyfile(file, bak)
                  if verbose:
                      print("backed up", file, "to", bak)
              with open(file, "w") as f:
                  r.write(f)
              if verbose:
                  print("wrote new", file)
          return True
      else:
          if verbose:
              print("unchanged.")
          return False
  
file_path: Theano/theano/misc/hooks/reindent.py
imports: from __future__ import absolute_import, print_function, division
  import tokenize
  import os, shutil
  import sys
  from six.moves import xrange
label_desc: Use image node_id 4 for calling a global function with example usage: check(file) and returns: True, False