def _FilesMatching(root, predicate=(lambda f: True)):
 matches = []
 for (path, _, files) in os.walk(root):
  matches += [os.path.join(path, f) for f in files if predicate(f)]
 return matches

def _FilesMatching ( root , predicate = ( lambda f : True ) ) : matches = [ ] for ( path , _ , files ) in os . walk ( root ) : matches += [ os . path . join ( path , f ) for f in files if predicate ( f ) ] return matches
finds all files under the given root that match the given predicate .