import itertools


def disjoint_subsets(list_a: list, groups):
    """Problem 27: Group elements of set into disjoint subsets.

    Parameters
    ----------
    list_a : list
        The input list
    groups

    Returns
    -------

    Raises
    ------
    TypeError
        If the given argument is not of `list` type

    """
    if not isinstance(list_a, list):
        raise TypeError('The argument given is not of `list` type.')

    set_a = set(list_a)
    # Find all combinations with the given plurality of the first subset
    first_set = itertools.combinations(set_a, groups[0])
    disjoint_list = []
    for x in first_set:
        # For every subset of the possible combinations of the first
        # group, remove its members and find all combinations with
        # given plurality of the second subset
        temp_subset = set_a - set(x)
        second_set = itertools.combinations(temp_subset, groups[1])
        list_x = list(x)
        for y in second_set:
            subset = [list_x, list(y), list(temp_subset - set(y))]
            disjoint_list.append(subset)
    return disjoint_list