<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate(self):
 """generate tar file ..Usage:: """

        if self._tar_buffer.tell():
            self._tar_buffer.seek(0, 0)
            yield self._tar_buffer.read()

        for fname in self._files_to_add:
            last = self._tar_buffer.tell()
            self._tar_obj.add(fname)
            self._tar_buffer.seek(last, os.SEEK_SET)
            data = self._tar_buffer.read()
            yield data

        for info, content in self._ios_to_add.items():
            last = self._tar_buffer.tell()
            self._tar_obj.addfile(info, content)
            self._tar_buffer.seek(last, os.SEEK_SET)
            data = self._tar_buffer.read()
            yield data

        self._tar_obj.close()
        yield self._tar_buffer.read()
        self._generated = True