'Construct a ZipFile or ContextualZipFile as appropriate.'

def __new__(cls, *args, **kwargs):

    if hasattr(zipfile.ZipFile, '__exit__'):
        return zipfile.ZipFile(*args, **kwargs)
    return super(ContextualZipFile, cls).__new__(cls)
