def _showwarning(message, category, filename, lineno, file=None, line=None):
 if (file is not None):
  if (_warnings_showwarning is not None):
   _warnings_showwarning(message, category, filename, lineno, file, line)
 else:
  s = warnings.formatwarning(message, category, filename, lineno, line)
  logger = getLogger('py.warnings')
  if (not logger.handlers):
   logger.addHandler(NullHandler())
  logger.warning('%s', s)

def _showwarning ( message , category , filename , lineno , file = None , line = None ) : if ( file is not None ) : if ( _warnings_showwarning is not None ) : _warnings_showwarning ( message , category , filename , lineno , file , line ) else : s = warnings . formatwarning ( message , category , filename , lineno , line ) logger = getLogger ( 'py.warnings' ) if ( not logger . handlers ) : logger . addHandler ( NullHandler ( ) ) logger . warning ( '%s' , s )
implementation of showwarnings which redirects to logging .