code: def safe_print(*objects, **kwargs):
      """Safe print function for backwards compatibility."""
      # Get stream
      file = kwargs.pop("file", sys.stdout)
      if isinstance(file, str):
          file = getattr(sys, file)
  
      # Get flush
      flush = kwargs.pop("flush", False)
  
      # Print
      print(*objects, file=file, **kwargs)
  
      # Need to flush outside print function for python2 compatibility
      if flush:
          file.flush()
  
imports: from __future__ import division, print_function, with_statement
  import os
  import sys
  import warnings
  import subprocess
  from numpy import array
  from ..config import get_ivals
  from .exceptions import ParallelProcessingError, ParallelProcessingWarning
  from time import sleep
label_desc: Use image node_id 7 for calling a global function with example usage: safe_print() without return types