You can use the tarfile libraries extract() , extractall() or extractfile() . Therefore, you must have access to non-top-level objects in the archive.
Just note that the path in extractall () is not the path inside the archive, but the path to which you want to extract it, so installing baz will not help there.
You will probably have the first call to getmembers() , then drag the list down so you want, then call one of the above extraction methods.
source share