code: def make_needed(pattern, path_to_directory, wanted):
      
      if wanted:
          def needed(name):
              return fnmatch(name, pattern) and wanted(
                  os.path.join(path_to_directory, name))
          return needed
      else:
          return lambda name: fnmatch(name, pattern)
docs: Make a method to check if an item matches the pattern, and is wanted
  
      If wanted is None just check the pattern