'Return the next member of the archive as a TarInfo object, when
TarFile is opened for reading. Return None if there is no more
available.'

def next(self):

    self._check('ra')
    if (self.firstmember is not None):
        m = self.firstmember
        self.firstmember = None
        return m
    if (self.offset != self.fileobj.tell()):
        self.fileobj.seek((self.offset - 1))
        if (not self.fileobj.read(1)):
            raise ReadError('unexpected    end    of    data')
    tarinfo = None
    while True:
        try:
            tarinfo = self.tarinfo.fromtarfile(self)
        except EOFHeaderError as e:
            if self.ignore_zeros:
                self._dbg(2, ('0x%X:    %s' % (self.offset, e)))
                self.offset += BLOCKSIZE
                continue
        except InvalidHeaderError as e:
            if self.ignore_zeros:
                self._dbg(2, ('0x%X:    %s' % (self.offset, e)))
                self.offset += BLOCKSIZE
                continue
            elif (self.offset == 0):
                raise ReadError(str(e))
        except EmptyHeaderError:
            if (self.offset == 0):
                raise ReadError('empty    file')
        except TruncatedHeaderError as e:
            if (self.offset == 0):
                raise ReadError(str(e))
        except SubsequentHeaderError as e:
            raise ReadError(str(e))
        break
    if (tarinfo is not None):
        self.members.append(tarinfo)
    else:
        self._loaded = True
    return tarinfo
