import time


def display_results(start_time, optimal_efficiency, optimal_bandgaps, file_name, stack):   
    """ Display main results for manage_input_output."""
    if stack.number_of_bandgaps == 1:
        print('The maximum efficiency is ' + str(round(optimal_efficiency, 3)) + '%.\n')
    else:
        print('The maximum efficiency is ' + str(round(optimal_efficiency, 3)) + '% with bandgaps of '
              + str(optimal_bandgaps[0:stack.number_of_bandgaps]) + ' eV.\n')
    # Give computation time.
    stop_time = time.time()
    print('More are given in file '+file_name+'. The calculations took')
    times = stop_time - start_time
    if times > 3600:
        print(str(round(times/3600, 3))+' hours.\n')
    if times > 60:
        print(str(round(times/60, 3))+' minutes.\n')
    else:
        print(str(round(times, 3))+' seconds.\n')
    return True