code: def _cull(potential, matches, verbose=0):
      """Cull inappropriate matches. Possible reasons:
          - a duplicate of a previous match
          - not a disk file
          - not executable (non-Windows)
      If 'potential' is approved it is returned and added to 'matches'.
      Otherwise, None is returned.
      """
      for match in matches:  # don't yield duplicates
          if _samefile(potential[0], match[0]):
              if verbose:
                  sys.stderr.write("duplicate: %s (%s)\n" % potential)
              return None
      else:
          if not stat.S_ISREG(os.stat(potential[0]).st_mode):
              if verbose:
                  sys.stderr.write(
                      "not a regular file: %s (%s)\n" % potential
                  )
          elif sys.platform != "win32" and not os.access(
              potential[0], os.X_OK
          ):
              if verbose:
                  sys.stderr.write(
                      "no executable access: %s (%s)\n" % potential
                  )
          else:
              matches.append(potential)
              return potential
  
file_path: python-markdown2/tools/which.py
imports: import os
  import sys
  import getopt
  import stat
label_desc: Use image node_id 3 for calling a global function with example usage: _cull(potential, matches, verbose) and returns: None, potential