def try_printout(data, out, opts, **kwargs):
 try:
  printout = get_printout(out, opts)(data, **kwargs)
  if (printout is not None):
   return printout.rstrip()
 except (KeyError, AttributeError, TypeError):
  log.debug(traceback.format_exc())
  try:
   printout = get_printout('nested', opts)(data, **kwargs)
   if (printout is not None):
    return printout.rstrip()
  except (KeyError, AttributeError, TypeError):
   log.error('Nested output failed: ', exc_info=True)
   printout = get_printout('raw', opts)(data, **kwargs)
   if (printout is not None):
    return printout.rstrip()

def try_printout ( data , out , opts , ** kwargs ) : try : printout = get_printout ( out , opts ) ( data , ** kwargs ) if ( printout is not None ) : return printout . rstrip ( ) except ( KeyError , AttributeError , TypeError ) : log . debug ( traceback . format_exc ( ) ) try : printout = get_printout ( 'nested' , opts ) ( data , ** kwargs ) if ( printout is not None ) : return printout . rstrip ( ) except ( KeyError , AttributeError , TypeError ) : log . error ( 'Nested output failed: ' , exc_info = True ) printout = get_printout ( 'raw' , opts ) ( data , ** kwargs ) if ( printout is not None ) : return printout . rstrip ( )
safely get the string to print out .