def get_indexes_from_best_path(best_path):
    """Grab the reference and event index of the best path from the maximum_expected_accuracy_alignment function.
    :param best_path: output from maximum_expected_accuracy_alignment
    :return: list of events [[ref_pos, event_pos]...]
    """
    path = []
    while best_path[4]:
        ref_pos = best_path[0]
        event_pos = best_path[1]
        path.append([ref_pos, event_pos])
        best_path = best_path[4]
    # gather last event
    ref_pos = best_path[0]
    event_pos = best_path[1]
    path.append([ref_pos, event_pos])
    # flip ordering of path
    return path[::-1]