def diff(prev_snapshot, next_snapshot):
    """Return a dict containing changes between two snapshots."""

    snapshot_diff = {
        'left_only': [],
        'right_only': [],
        'changed': [],
        'common': [],
    }

    for path in set(prev_snapshot.keys()) | set(next_snapshot.keys()):
        if path in prev_snapshot and path not in next_snapshot:
            snapshot_diff['left_only'].append(path)
        elif path not in prev_snapshot and path in next_snapshot:
            snapshot_diff['right_only'].append(path)
        elif next_snapshot[path].mtime != prev_snapshot[path].mtime:
            if next_snapshot[path].isfile:
                snapshot_diff['changed'].append(path)
        else:
            snapshot_diff['common'].append(path)

    return snapshot_diff