tarfile.is_tarfile()

tarfile.is_tarfile(name)[source]

Return True if name points to a tar archive that we are able to handle, else return False.