code: def exclude_file(sp, f):
      
      # Make everything a list if it isn't already
      for k in sp:
          if k in ['exclude_fn', 'exclude_fn_re' 'exclude_contents', 'exclude_contents_re']:
              if not isinstance(sp[k], list):
                  sp[k] = [sp[k]]
  
      # Search by file name (glob)
      if 'exclude_fn' in sp:
          for pat in sp['exclude_fn']:
              if fnmatch.fnmatch(f['fn'], pat):
                  return True
  
      # Search by file name (regex)
      if 'exclude_fn_re' in sp:
          for pat in sp['exclude_fn_re']:
              if re.match( pat, f['fn']):
                  return True
  
      # Search the contents of the file
      if 'exclude_contents' in sp or 'exclude_contents_re' in sp:
          # Compile regex patterns if we have any
          if 'exclude_contents_re' in sp:
              sp['exclude_contents_re'] = [re.compile(pat) for pat in sp['exclude_contents_re']]
          with io.open (os.path.join(f['root'],f['fn']), "r", encoding='utf-8') as fh:
              for line in fh:
                  if 'exclude_contents' in sp:
                      for pat in sp['exclude_contents']:
                          if pat in line:
                              return True
                  if 'exclude_contents_re' in sp:
                      for pat in sp['exclude_contents_re']:
                          if re.search(pat, line):
                              return True
      return False
docs: Exclude discovered files if they match the special exclude_
      search pattern keys