docs: def zip_file(fn, mode="r"):
      """
      returns either a zipfile.ZipFile instance or an ExplodedZipFile
      instance, depending on whether fn is the name of a valid zip file,
      or a directory.
      """
  
      if isdir(fn):
          return ExplodedZipFile(fn)
      elif is_zipfile(fn):
          return ZipFile(fn, mode)
      else:
          raise Exception("cannot treat as an archive: %r" % fn)