def diffdict(new, old, inexistent_value=None):
    """diffdict(new, old) -> [(key, new_value, old_value),...]

Returns the differences between two dictionaries.
In case of addition or deletion, old or new values are None."""
    changes = []
    for key, val in old.iteritems():
        new_val = new.get(key, Ellipsis)
        if new_val is Ellipsis:
            changes.append((key, inexistent_value, val))
        elif new_val != val:
            changes.append((key, new_val, val))
    for key, val in new.iteritems():
        old_val = old.get(key, Ellipsis)
        if old_val is Ellipsis:
            changes.append((key, val, inexistent_value))
    return changes
