def print_cli(msg):
 try:
  try:
   print(msg)
  except UnicodeEncodeError:
   print(msg.encode('utf-8'))
 except IOError as exc:
  if (exc.errno != errno.EPIPE):
   raise

def print_cli ( msg ) : try : try : print ( msg ) except UnicodeEncodeError : print ( msg . encode ( 'utf-8' ) ) except IOError as exc : if ( exc . errno != errno . EPIPE ) : raise
wrapper around print() that suppresses tracebacks on broken pipes .