def translate_js_with_compilation_plan(js, HEADER=DEFAULT_HEADER):
 (match_increaser_str, match_increaser_num, compilation_plan) = get_compilation_plan(js)
 cp_hash = hashlib.md5(compilation_plan.encode('utf-8')).digest()
 try:
  python_code = cache[cp_hash]['proto_python_code']
 except:
  parser = pyjsparser.PyJsParser()
  parsed = parser.parse(compilation_plan)
  translating_nodes.clean_stacks()
  python_code = translating_nodes.trans(parsed)
  cache[cp_hash] = {'compilation_plan': compilation_plan, 'proto_python_code': python_code}
 python_code = match_increaser_str.wrap_up(python_code)
 python_code = match_increaser_num.wrap_up(python_code)
 return (HEADER + python_code)

def translate_js_with_compilation_plan ( js , HEADER = DEFAULT_HEADER ) : ( match_increaser_str , match_increaser_num , compilation_plan ) = get_compilation_plan ( js ) cp_hash = hashlib . md5 ( compilation_plan . encode ( 'utf-8' ) ) . digest ( ) try : python_code = cache [ cp_hash ] [ 'proto_python_code' ] except : parser = pyjsparser . PyJsParser ( ) parsed = parser . parse ( compilation_plan ) translating_nodes . clean_stacks ( ) python_code = translating_nodes . trans ( parsed ) cache [ cp_hash ] = { 'compilation_plan' : compilation_plan , 'proto_python_code' : python_code } python_code = match_increaser_str . wrap_up ( python_code ) python_code = match_increaser_num . wrap_up ( python_code ) return ( HEADER + python_code )
js has to be a javascript source code .