def _write_pred_sum(path_res, ipred, ndone, ntot, t_pred):
    """ `_write_pred_sum` writes a text file that summarized the overall
    progress of the predictions at 'popex.path_res'.


    The file structure is as followes:
        | <popex.path_res>$
        |    └- pred_progress.txt


    Parameters
    ----------
    path_res : str
        Path to where the results should be saved
    ipred : int
        Index of last predictions
    ndone : int
        Number of computed predictions
    ntot : int
        Number of total predictions
    t_pred : float
        Total time elapsed


    Returns
    -------
    None
    """
    bar_width = 40
    progress = ndone / ntot
    t_mod = t_pred / ndone
    m_pred, s_pred = divmod(t_pred, 60)
    h_pred, m_pred = divmod(m_pred, 60)
    m_mod, s_mod = divmod(t_mod, 60)
    h_mod, m_mod = divmod(m_mod, 60)
    t_est = t_pred / progress
    m_est, s_est = divmod(t_est, 60)
    h_est, m_est = divmod(m_est, 60)
    with open('{}pred_progress.txt'.format(path_res), 'w+') as file:
        file.write('PREDICTION PROGRESS SUMMARY\n')
        file.write('---------------------------\n')
        file.write('\n')
        nfull = int(bar_width * progress)
        nempty = bar_width - nfull
        file.write('  Status\n')
        file.write('    n_mod    = {:6d} / {:6d}    (last: {:6d})\n'.format
            (ndone, ntot, ipred))
        file.write('    [{:s}{:s}]'.format('-' * nfull, ' ' * nempty))
        file.write(' {:3.0f}%\n'.format(progress * 100))
        file.write('\n')
        file.write('  Time\n')
        file.write('    T_el     = {:4.0f}[h] {:2.0f}[m] {:5.2f}[s]\n'.
            format(h_pred, m_pred, s_pred))
        file.write('    T / mod  = {:4.0f}[h] {:2.0f}[m] {:5.2f}[s]\n'.
            format(h_mod, m_mod, s_mod))
        file.write('    T_tot    = {:4.0f}[h] {:2.0f}[m] {:5.2f}[s]\n'.
            format(h_est, m_est, s_est))
