def subst_favorite_query_args(query, args):
for idx, val in enumerate(args):<EOL><INDENT>subst_var = '<STR_LIT:$>' + str(idx + <NUM_LIT:1>)<EOL>if subst_var not in query:<EOL><INDENT>return [None, '<STR_LIT>' + subst_var + '<STR_LIT>' + query]<EOL><DEDENT>query = query.replace(subst_var, val)<EOL><DEDENT>match = re.search('<STR_LIT>', query)<EOL>if match:<EOL><INDENT>return[None, '<STR_LIT>' + match.group(<NUM_LIT:0>) + '<STR_LIT>' + query]<EOL><DEDENT>return [query, None]<EOL>
replace positional parameters ($1...$N) in query.