def add_ranks_to_dict(result, variable_names, scoring_strategy):
    """Takes a list of (var, score) and converts to a dictionary

    :param result: a dict of {var_index: score}
    :param variable_names: a list of variable names
    :param scoring_strategy: a function to be used for determining optimal
        variables. Should be of the form ([floats]) -> index
    """
    if len(result) == 0:
        return dict()
    result_dict = dict()
    rank = 0
    while len(result) > 1:
        best_var = result.keys()[scoring_strategy(result.values())]
        score = result.pop(best_var)
        result_dict[variable_names[best_var]] = rank, score
        rank += 1
    var, score = result.items()[0]
    result_dict[variable_names[var]] = rank, score
    return result_dict
