def resolve(tex):
<EOL>soup = TexSoup(tex)<EOL>for subimport in soup.find_all('<STR_LIT>'):<EOL><INDENT>path = subimport.args[<NUM_LIT:0>] + subimport.args[<NUM_LIT:1>]<EOL>subimport.replace_with(*resolve(open(path)).contents)<EOL><DEDENT>for _import in soup.find_all('<STR_LIT>'):<EOL><INDENT>_import.replace_with(*resolve(open(_import.args[<NUM_LIT:0>])).contents)<EOL><DEDENT>for include in soup.find_all('<STR_LIT>'):<EOL><INDENT>include.replace_with(*resolve(open(include.args[<NUM_LIT:0>])).contents)<EOL><DEDENT>return soup<EOL>
Resolve all imports and update the parse tree.

    Reads from a tex file and once finished, writes to a tex file.