def dict_compare(dictionary_1, dictionary_2):
    """Compare two dictionaries and return keys of the differing items.

    From https://stackoverflow.com/questions/4527942/comparing-two-dictionaries-in-python/4527957

    Parameters
    ----------
    dictionary_1 : dict
        first dictionary
    dictionary_2 : dict
        second dictionary

    Returns
    -------
    added, removed, modified, same : set
        Sets of dictionary keys that were added, removed, modified, or are the same

    """
    d1_keys = set(dictionary_1.keys())
    d2_keys = set(dictionary_2.keys())
    intersect_keys = d1_keys.intersection(d2_keys)
    added = d1_keys - d2_keys
    removed = d2_keys - d1_keys
    modified = {o : (dictionary_1[o], dictionary_2[o]) for o in intersect_keys
                if dictionary_1[o] != dictionary_2[o]}
    same = set(o for o in intersect_keys if dictionary_1[o] == dictionary_2[o])
    return added, removed, modified, same