'get the last timestamp of the mpeg, return -1 if this is not possible'

def get_endpos(self):

    if ((not hasattr(self, 'filename')) or (not hasattr(self, 'start'))):
        return None
    length = os.stat(self.filename)[stat.ST_SIZE]
    if (length < self.__sample_size__):
        return
    file = open(self.filename)
    file.seek((length - self.__sample_size__))
    buffer = file.read(self.__sample_size__)
    end = None
    while 1:
        pos = self.__search__(buffer)
        if (pos == None):
            break
        end = (self.get_time(buffer[pos:]) or end)
        buffer = buffer[(pos + 100):]
    file.close()
    return end
