def translate_file(input_path, output_path):
js = get_file_contents(input_path)<EOL>py_code = translate_js(js)<EOL>lib_name = os.path.basename(output_path).split('<STR_LIT:.>')[<NUM_LIT:0>]<EOL>head = '<STR_LIT>' % repr(<EOL>lib_name)<EOL>tail = '<STR_LIT>' % lib_name<EOL>out = head + py_code + tail<EOL>write_file_contents(output_path, out)<EOL>
Translates input JS file to python and saves the it to the output path.
It appends some convenience code at the end so that it is easy to import JS objects.

For example we have a file 'example.js' with:   var a = function(x) {return x}
translate_file('example.js', 'example.py')

Now example.py can be easily importend and used:
>>> from example import example
>>> example.a(30)
30