code: def exists(self, filename):
          
          # Technically, the results of the casper.jxml page list the
          # package files on the server. This is an undocumented
          # interface, however.
          result = False
          if is_package(filename):
              packages = self.connection["jss"].Package().retrieve_all()
              for package in packages:
                  if package.findtext("filename") == filename:
                      result = True
                      break
          else:
              scripts = self.connection["jss"].Script().retrieve_all()
              for script in scripts:
                  if script.findtext("filename") == filename:
                      result = True
                      break
  
          return result
docs: Check for the existence of a package or script.
  
          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, please use the alternate
          exists_with_casper method.  For example, it's possible to create
          a Package object but never upload a package file, and this
          method will still return "True".
  
          Also, this may be slow, as it needs to retrieve the complete
          list of packages from the server.