@contextlib.contextmanager
def tarfile_open(*args, **kwargs):
    tf = tarfile.open(*args, **kwargs)
    try:
        yield tf
    finally:
        tf.close()
Compatibility layer because python2.6
dataset/ETHPy150Open pre-commit/pre-commit/pre_commit/util.py/tarfile_open