'Updates or creates snapshot metadata.
If delete is True, metadata items that are not specified in the
`metadata` argument will be deleted.'

@wrap_check_policy
def update_snapshot_metadata(self, context, snapshot, metadata, delete=False):

    if delete:
        _metadata = metadata
    else:
        orig_meta = snapshot.metadata
        _metadata = orig_meta.copy()
        _metadata.update(metadata)
    utils.check_metadata_properties(_metadata)
    snapshot.metadata = _metadata
    snapshot.save()
    LOG.info('Update    snapshot    metadata    completed    successfully.', resource=snapshot)
    return snapshot.metadata
