def _state_diff(state, previous_state):
    """A dict to show the new, changed and removed attributes between two states

    Parameters
    ----------
    state : dict
    previous_state : dict

    Returns
    -------
    dict
        with keys 'new', 'changed' and 'removed' for each of those with content
    """
    new = {k: v for k, v in state.items() if k not in previous_state}
    changed = {
        k: {"from": previous_state[k], "to": v}
        for k, v in state.items()
        if k in previous_state and v != previous_state[k]
    }
    removed = {k: v for k, v in previous_state.items() if k not in state}
    diff = {"new": new, "changed": changed, "removed": removed}
    result = {k: v for k, v in diff.items() if len(v) > 0}
    return result if len(result) > 0 else None