def rank_collo(collo_measures, sort_by='G2', reverse=True, freq_cutoff=1):
    """Helper function to sort the results of collostructional analyses as returned by dca() and cca().

    Parameters
    ----------
    collo_measures : dict
        The analysis results returned by dca() or cca()
    sort_by : str, optional
        The association measure used to sort the result, by default 'G2'. 
        See measure() for the list of possible assoiciation measures to use for sorting.
    reverse : bool, optional
        Whether to sort from high values to low ones, by default True
    freq_cutoff : int, optional
        The minimal number of occurrences required to be included in the
        results, by default 1

    Returns
    -------
    list
        A list of tuple of length three, with the second element being
        the association statistic used for sorting and the third element the frequency.
    """
    out = sorted( ((k, v[sort_by], v['freq']) for k, v in collo_measures.items() if v['freq'] >= freq_cutoff),
    key=lambda x: x[1], reverse=reverse)

    return out