def convert(ast):
if ast and ast.type == "<STR_LIT>":<EOL><INDENT>if (<EOL>ast.name != "<STR_LIT>"<EOL>and ast.name in spec["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT:list>"]<EOL>):<EOL><INDENT>print("<STR_LIT:name>", ast.name, "<STR_LIT:type>", ast.type)<EOL>ast = convert_activity(ast)<EOL>return ast  <EOL><DEDENT>elif ast.name in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>ast = convert_tloc(ast)<EOL><DEDENT>fus_flag = False<EOL>for idx, arg in enumerate(ast.args):<EOL><INDENT>if arg.__class__.__name__ == "<STR_LIT>":<EOL><INDENT>if arg.name in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>ast.args[idx] = convert_sub(arg)<EOL><DEDENT>elif arg.name in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>ast.args[idx] = convert_trunc(arg)<EOL><DEDENT>elif arg.name in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>ast.args[idx] = convert_pmod(arg)<EOL><DEDENT>elif arg.name in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>fus_flag = True<EOL><DEDENT>ast.args[idx] = convert(ast.args[idx])<EOL><DEDENT><DEDENT>if fus_flag:<EOL><INDENT>ast = convert_fus(ast)<EOL><DEDENT><DEDENT>return ast<EOL>
Convert BEL1 AST Function to BEL2 AST Function