def _process_pstats(ps, clean_text=None, verbose=False, fLOG=None):
    """
    Converts class `Stats <https://docs.python.org/3/library/
    profile.html#pstats.Stats>`_ into something
    readable for a dataframe.

    :param ps: instance of type :func:`pstats.Stats`
    :param clean_text: function to clean function names
    :param verbose: change verbosity
    :param fLOG: logging function
    :return: list of rows
    """
    if clean_text is None:
        clean_text = lambda x: x

    def add_rows(rows, d):
        tt1, tt2 = 0, 0
        for k, v in d.items():
            stin = 0
            stall = 0
            if verbose and fLOG is not None:
                fLOG("[pstats] %s=%r" % (
                    (clean_text(k[0].replace("\\", "/")), ) + k[1:],
                    v))
            if len(v) < 5:
                continue
            row = {
                'file': "%s:%d" % (clean_text(k[0].replace("\\", "/")), k[1]),
                'fct': k[2],
                'ncalls1': v[0],
                'ncalls2': v[1],
                'tin': v[2],
                'tall': v[3]
            }
            stin += v[2]
            stall += v[3]
            if len(v) == 5:
                t1, t2 = add_rows(rows, v[-1])
                stin += t1
                stall += t2
            row['cum_tin'] = stin
            row['cum_tall'] = stall
            rows.append(row)
            tt1 += stin
            tt2 += stall
        return tt1, tt2

    rows = []
    add_rows(rows, ps.stats)
    return rows