def group(
            self,
            prefix_function=None,
            prefix_function_path=None,
            prefix_length=2,
            merge_min_size=0,
            merge_across_first=False
    ):
        def return_triple(groups):
            """
            Return a (list_special, list, dict),
            where the list contains the sorted keys of dict,
            and list_special contains the list of SPECIAL entries.
            """
            spec = None
            if u"SPECIAL" in groups:
                spec = groups[u"SPECIAL"]
                del groups[u"SPECIAL"]
            keys = sorted(groups.keys())
            return (spec, keys, groups)

        # load the prefix function
        get_prefix = get_prefix_default
        if prefix_function is not None:
            get_prefix = prefix_function
        elif prefix_function_path is not None:
            try:
                get_prefix = imp.load_source("", prefix_function).get_prefix
            except:
                pass

        # create groups
        raw_groups = {}
        for index in self.entries_index_sorted:
            entry = self.entries[index]
            prefix = get_prefix(entry.headword, prefix_length)
            if not prefix in raw_groups:
                raw_groups[prefix] = []
            raw_groups[prefix].append(self.entries[index])

        # if no merge is requested, return
        if merge_min_size == 0:
            return return_triple(raw_groups)

        # merge small groups
        merged_groups = {}
        if u"SPECIAL" in raw_groups:
            # special is never merged
            merged_groups[u"SPECIAL"] = raw_groups[u"SPECIAL"]
            del raw_groups[u"SPECIAL"]
        keys = sorted(raw_groups.keys())
        accumulator_key = keys[0]
        accumulator = raw_groups[accumulator_key]
        for key in keys[1:]:
            if (
                    (len(accumulator) >= merge_min_size) or
                    ((not merge_across_first) and (key[0] != accumulator_key[0]))
                ):
                merged_groups[accumulator_key] = accumulator
                accumulator_key = key
                accumulator = raw_groups[accumulator_key]
            else:
                accumulator += raw_groups[key]
        merged_groups[accumulator_key] = accumulator
        return return_triple(merged_groups)
Tests the return of get function
dataset/ETHPy150Open pettarin/penelope/penelope/dictionary.py/Dictionary.group--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/modules/mac_sysctl_test.py/DarwinSysctlTestCase.test_get