def _prepare_archive_at_path(filename):
 try:
  with ZipFile(filename, 'r') as archive:
   archive.close()
 except BadZipfile:
  return None
 if _is_overwritten(filename):
  log.debug('ZIP file contains a file with the same name, original is         going to be overwrite')
  new_zip_path = (filename + _random_extension())
  move(filename, new_zip_path)
  filename = new_zip_path
 return filename

def _prepare_archive_at_path ( filename ) : try : with ZipFile ( filename , 'r' ) as archive : archive . close ( ) except BadZipfile : return None if _is_overwritten ( filename ) : log . debug ( 'ZIP file contains a file with the same name, original is         going to be overwrite' ) new_zip_path = ( filename + _random_extension ( ) ) move ( filename , new_zip_path ) filename = new_zip_path return filename
verifies that theres a readable zip archive at the given path .