code: def is_zipfile(filename):
      
      try:
          fpin = open(filename, "rb")
          endrec = _EndRecData(fpin)
          fpin.close()
          if endrec:
              return True                 # file has correct magic number
      except IOError:
          pass
      return False
docs: Quickly see if file is a ZIP file by checking the magic number.