def difference(d1, d2):
    """Difference of two dicts.
    Return elements of the first dict not existing in the second dict."""
    ret = {}
    for k in d1:
        if k not in d2:
            ret[k] = d1[k]
    return ret