code: def print_callback(val):
      """
      Internal function.
      This function is called via a call back returning from IPC to Cython
      to Python. It tries to perform incremental printing to IPython Notebook or
      Jupyter Notebook and when all else fails, just prints locally.
      """
      success = False
      try:
          # for reasons I cannot fathom, regular printing, even directly
          # to io.stdout does not work.
          # I have to intrude rather deep into IPython to make it behave
          if have_ipython:
              if InteractiveShell.initialized():
                  IPython.display.publish_display_data(
                      {
                          "text/plain": val,
                          "text/html": "<pre>" + val + "</pre>",
                      }
                  )
                  success = True
      except:
          pass
  
      if not success:
          print(val)
          sys.stdout.flush()
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: print_callback(val) without return types