def __init__(self, tarfile, file):

        fh = open(tarfile, "rb")

        while 1:

            s = fh.read(512)
            if len(s) != 512:
                raise IOError, "unexpected end of tar file"

            name = s[:100]
            i = string.find(name, chr(0))
            if i == 0:
                raise IOError, "cannot find subfile"
            if i > 0:
                name = name[:i]

            size = string.atoi(s[124:136], 8)

            if file == name:
                break

            fh.seek((size + 511) & (~511), 1)

        # Open region
        ContainerIO.ContainerIO.__init__(self, fh, fh.tell(), size)
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/site-packages/PIL/TarIO.py/TarIO.__init__/original