def _create_groups(together: list):
    """Returns unions of pairs

    Args:
        together (list): Pairs of individuals who should be together

    Returns:
        list: Nested list of groups, ordered largest to smallest

    Example:
        >>> together = [["a", "b"], ["a", "e"], ["d", "g"]]
        >>> _create_groups(together)
        [["a", "b", "e"], ["d", "g"]]
    """
    groups = []
    if together is None:
        return groups

    for pair in together:
        if groups == []:
            groups.append(pair)
            continue

        bool_union = False
        for group in groups:
            intersect = list(set(pair) & set(group))

            if intersect != []:
                union = list(set(pair) | set(group))
                groups.remove(group)
                groups.append(union)
                bool_union = True
                break

        if not bool_union:
            groups.append(pair)

    groups.sort(key=len, reverse=True)
    return groups