<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __write_text(self, outfile):
 """ Write text information into file This method should be called only from ``write_idat`` method or chunk order will be ruined. """

        for k, v in self.text.items():
            if not isinstance(v, bytes):
                try:
                    international = False
                    v = v.encode('latin-1')
                except UnicodeEncodeError:
                    international = True
                    v = v.encode('utf-8')
            else:
                international = False
            if not isinstance(k, bytes):
                k = strtobytes(k)
            if international:
                # No compress, language tag or translated keyword for now
                write_chunk(outfile, 'iTXt', k + zerobyte +
                            zerobyte + zerobyte +
                            zerobyte + zerobyte + v)
            else:
                write_chunk(outfile, 'tEXt', k + zerobyte + v)