import itertools


def subsets(parent_set, include_empty=False, include_self=False):
    """
    Given a set of variable names, return all subsets
    :param parent_set: a set, or tuple, of variables
    :return: a set of tuples, each one denoting a subset
    """
    s = set()
    n = len(parent_set)
    for i in range(n - 1):
        for combo in itertools.combinations(list(parent_set), i + 1):
            s.add(tuple(sorted(combo)))
    if include_empty:
        s.add(tuple())
    if include_self:
        s.add(tuple(sorted(parent_set)))
    return s