<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def listen(self, io_in, io_out, io_err):
 """Listens to provided io stream and writes predictions to output. In case of errors, the error stream will be used. """

        for line in io_in:
            if line.strip().lower() == 'exit':
                break

            try:
                y_pred = self.process_line(line)
            except Exception as e:
                io_out.write('[]\n')
                io_err.write(
                    "Error while processing input row: {}"
                    "{}: {}\n".format(line, type(e), e))
                io_err.flush()
            else:
                io_out.write(ujson.dumps(y_pred.tolist()))
                io_out.write('\n')
                io_out.flush()