def divide_groups_into_isomorphic_sets(list_of_groups):
    """Divide the list of groups into sub-lists of groups that are isomorphic to each other.
    The purpose of this function is operate on the proper subgroups of a group to determine
    the unique subgroups, up to isomorphism.

    Parameters
    ----------
    list_of_groups : list
      A list of groups, e.g., the list of subgroups of a group.

    Returns
    -------
    list
      A list of lists of groups, where each sublist represents groups that are isomorphic to each other.
    """

    def iso_and_not_iso(gp, gps):
        """Divide the list of groups, gps, into two lists, those that are isomorphic to gp
        and those that are not."""
        iso_to_grp = []
        not_iso_to_grp = []
        for g in gps:
            if gp.isomorphic(g):
                iso_to_grp.append(g)
            else:
                not_iso_to_grp.append(g)
        return iso_to_grp, not_iso_to_grp

    def aux(result, remainder):
        """Recursively subdivide 'remainder' into lists that are isomorphic to its first member of the
        remainder list and those that are not.  Then, put those that are isomorphic to the first member
        into the 'result' list, and recurse on the remainder."""
        if len(remainder) == 0:
            return result
        else:
            first = remainder[0]
            rest = remainder
            iso_to_first, not_iso_to_first = iso_and_not_iso(first, rest)
            result.append(iso_to_first)
            return aux(result, not_iso_to_first)

    return aux([], list_of_groups)