code: def print_out(s, f=None, new_line=True):
      """Similar to print but with support to flush and output to a file."""
      if isinstance(s, bytes):
          s = s.decode("utf-8")
  
      if f:
          f.write(s.encode("utf-8"))
          if new_line:
              f.write(b"\n")
  
      # stdout
      out_s = s.encode("utf-8")
      if not isinstance(out_s, str):
          out_s = out_s.decode("utf-8")
      print(out_s, end="", file=sys.stdout)
  
      if new_line:
          sys.stdout.write("\n")
      sys.stdout.flush()
  
imports: from __future__ import print_function
  import codecs
  import collections
  import json
  import math
  import os
  import sys
  import time
  from distutils import version
  import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: print_out(s, f, new_line) without return types