def METHOD_NAME(self, end_seq=None):
    last_seq = None
    i = self.start_seq
    while True:
        if end_seq is not None and i >= end_seq:
            break
        if not os.path.exists(self.file_format_data % i):
            break
        if not os.path.exists(self.file_format_targets % i):
            break
        last_seq = i
        i += 1
    if end_seq is None:
        assert last_seq is not None, "None found. Check %s." % (self.file_format_data % self.start_seq)
        end_seq = last_seq
    else:
        assert last_seq == end_seq - 1, "Check %s." % (self.file_format_data % end_seq)
    assert end_seq > self.start_seq
    self._num_seqs = end_seq - self.start_seq