def js_escaped_string(string_for_js):
 if (string_for_js is None):
  string_for_js = ''
 string_for_js = decode.utf8(string_for_js)
 string_for_js = escapejs(string_for_js)
 return string_for_js

def js_escaped_string ( string_for_js ) : if ( string_for_js is None ) : string_for_js = '' string_for_js = decode . utf8 ( string_for_js ) string_for_js = escapejs ( string_for_js ) return string_for_js
mako filter that escapes text for use in a javascript string .