'This function is a bit pedantic and not functionally necessary.  It checks whether there is
no file pointing outside of the extraction, because ZipFile.extractall() has some potential
security holes.  See python zipfile documentation for more details.'

def zipfile_ok(self, path_to_archive):

    basename = os.path.realpath(os.path.dirname(path_to_archive))
    zip_archive = zipfile.ZipFile(path_to_archive)
    for member in zip_archive.namelist():
        member_path = os.path.realpath(os.path.join(basename, member))
        if (not member_path.startswith(basename)):
            return False
    return True
