def _handle_history_reply(self, msg):
content = msg['<STR_LIT:content>']<EOL>if '<STR_LIT>' not in content:<EOL><INDENT>self.log.error("<STR_LIT>"%content)<EOL>if content.get('<STR_LIT:status>', '<STR_LIT>') == '<STR_LIT>' andnot self._retrying_history_request:<EOL><INDENT>self.log.error("<STR_LIT>")<EOL>self._retrying_history_request = True<EOL>time.sleep(<NUM_LIT>)<EOL>self.kernel_manager.shell_channel.history(hist_access_type='<STR_LIT>',n=<NUM_LIT:1000>)<EOL><DEDENT>else:<EOL><INDENT>self._retrying_history_request = False<EOL><DEDENT>return<EOL><DEDENT>self._retrying_history_request = False<EOL>history_items = content['<STR_LIT>']<EOL>self.log.debug("<STR_LIT>", len(history_items))<EOL>items = []<EOL>last_cell = u"<STR_LIT>"<EOL>for _, _, cell in history_items:<EOL><INDENT>cell = cell.rstrip()<EOL>if cell != last_cell:<EOL><INDENT>items.append(cell)<EOL>last_cell = cell<EOL><DEDENT><DEDENT>self._set_history(items)<EOL>
Implemented to handle history tail replies, which are only supported
            by the IPython kernel.