<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _create_index_formula_lookup(formula_id2index, feature_folder, index2latex):
 """ Create a lookup file where the index is mapped to the formula id and the LaTeX command. Parameters formula_id2index : dict feature_folder : str Path to a folder in which a feature file as well as an index2formula_id.csv is. index2latex : dict Maps an integer index to a LaTeX command """

    index2formula_id = sorted(formula_id2index.items(), key=lambda n: n[1])
    index2formula_file = os.path.join(feature_folder, "index2formula_id.csv")
    with open(index2formula_file, "w") as f:
        f.write("index,formula_id,latex\n")
        for formula_id, index in index2formula_id:
            f.write("%i,%i,%s\n" % (index, formula_id, index2latex[index]))