'Printing with history cache management.
This is invoked everytime the interpreter needs to print, and is
activated by setting the variable sys.displayhook to it.'

def __call__(self, result=None):

    self.check_for_underscore()
    if ((result is not None) and (not self.quiet())):
        self.start_displayhook()
        self.write_output_prompt()
        (format_dict, md_dict) = self.compute_format_data(result)
        self.update_user_ns(result)
        self.fill_exec_result(result)
        if format_dict:
            self.write_format_data(format_dict, md_dict)
            self.log_output(format_dict)
        self.finish_displayhook()
