def run(self):
while not self._stopped.is_set():<EOL><INDENT>try:<EOL><INDENT>message = self.q.get(timeout=<NUM_LIT:0.1>)<EOL><DEDENT>except Empty:<EOL><INDENT>continue<EOL><DEDENT>dtype, data, ts = message<EOL>if dtype in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>self._response_handlers[dtype](dtype, data, ts)<EOL><DEDENT>except KeyError:<EOL><INDENT>self.log.error("<STR_LIT>"<EOL>"<STR_LIT>", dtype, message)<EOL><DEDENT><DEDENT>elif dtype == '<STR_LIT:data>':<EOL><INDENT>try:<EOL><INDENT>channel_id = data[<NUM_LIT:0>]<EOL>if channel_id != <NUM_LIT:0>:<EOL><INDENT>channel_type, *_ = self.channel_directory[channel_id]<EOL>self._data_handlers[channel_type](channel_type, data, ts)<EOL>self.update_timestamps(channel_id, ts)<EOL><DEDENT>else:<EOL><INDENT>self._handle_account(data=data, ts=ts)<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>self.log.error("<STR_LIT>",<EOL>message)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.log.error("<STR_LIT>", message)<EOL>continue<EOL><DEDENT><DEDENT>
Main routine.

        :return: