def arm_data_formatting(arm_data, values_list, number_of_flights,
    flight_data_list):
    """Takes in arm data and formats it correctly"""
    arm_plot_data = None
    if arm_data is True:
        arm_plot_data = []
        arm_info = [['id', 'ev'], ['time', 'ev']]
        for data_set in range(number_of_flights):
            arm_plot_data_temp = []
            for index in arm_info:
                values_list_index = 0
                for values_list_data in values_list[data_set]:
                    if index[1] == values_list_data[0].lower():
                        index.append(str(values_list_index))
                        for column in values_list[data_set][int(
                            values_list_index)][1:]:
                            if column[0].lower() == index[0]:
                                arm_label = flight_data_list[data_set]
                                arm_plot_data_temp.append([arm_label, column])
                                break
                    values_list_index += 1
            arm_plot_data.append(arm_plot_data_temp)
    arm_data_list = []
    if arm_data is True:
        for data_set in range(number_of_flights):
            if len(arm_plot_data[data_set][1]) != 0:
                arm_data_list.append(True)
            else:
                arm_data_list.append(False)
                print('Arm data is not present for data set {}'.format(str(
                    flight_data_list[data_set])))
        if all(arm_data_list) is True:
            arm_data = True
        else:
            arm_data = False
            print(
                'Arm data is not present or has not been imported properly. Make sure "EV" is present in the Data_sources.txt file, then run autoflpy again to re-generate the data.'
                )
    return arm_data, arm_plot_data
