def merge_set_dicts(dict1, dict2):
    """Merge two dictionaries of sets.

    :param dict1: First dictionary of sets.
    :type dict1: dict
    :param dict2: Second dictionary of sets.
    :type dict2: dict
    :returns:
        Merged dictionary containing all keys from both dictionaries,
        and for each shared key the value is a set of merged values.
    :rtype: dict
    """
    keys = dict1.keys() | dict2.keys()
    dict3 = {}
    for key in keys:
        if key in dict1.keys():
            set1 = dict1[key]
        else:
            set1 = set()
        if key in dict2.keys():
            set2 = dict2[key]
        else:
            set2 = set()
        dict3[key] = set1 | set2
    return dict3
