def jsbeautify(javascript):
 if (not HAVE_JSBEAUTIFIER):
  return javascript
 with _jsbeautify_lock:
  (origout, sys.stdout) = (sys.stdout, StringIO())
  javascript = jsbeautifier.beautify(javascript)
  if (sys.stdout.getvalue() not in _jsbeautify_blacklist):
   log.warning('jsbeautifier returned error: %s', sys.stdout.getvalue())
  sys.stdout = origout
 return javascript

def jsbeautify ( javascript ) : if ( not HAVE_JSBEAUTIFIER ) : return javascript with _jsbeautify_lock : ( origout , sys . stdout ) = ( sys . stdout , StringIO ( ) ) javascript = jsbeautifier . beautify ( javascript ) if ( sys . stdout . getvalue ( ) not in _jsbeautify_blacklist ) : log . warning ( 'jsbeautifier returned error: %s' , sys . stdout . getvalue ( ) ) sys . stdout = origout return javascript
beautifies javascript through jsbeautifier and ignore some messages .