code: def exists_using_casper(self, filename):
          
          casper_results = casper.Casper(self.connection["jss"])
          distribution_servers = casper_results.find("distributionservers")
  
          # Step one: Build a list of sets of all package names.
          all_packages = []
          for distribution_server in distribution_servers:
              packages = set()
              for package in distribution_server.findall("packages/package"):
                  packages.add(os.path.basename(package.find("fileURL").text))
  
              all_packages.append(packages)
  
          # Step two: Intersect the sets.
          base_set = all_packages.pop()
          for packages in all_packages:
              base_set = base_set.intersection(packages)
  
          # Step three: Check for membership.
          return filename in base_set
docs: Check for the existence of a package file.
  
          Unlike other DistributionPoint types, JDS and CDP types have no
          documented interface for checking whether the server and its
          children have a complete copy of a file. The best we can do is
          check for an object using the API /packages URL--JSS.Package()
          or /scripts and look for matches on the filename.
  
          If this is not enough, this method uses the results of the
          casper.jxml page to determine if a package exists. This is an
          undocumented feature and as such should probably not be relied
          upon. Please note, scripts are not listed per-distributionserver
          like packages. For scripts, the best you can do is use the
          regular exists method.
  
          It will test for whether the file exists on ALL configured
          distribution servers. This may register False if the JDS is busy
          syncing them.