def _check_metadata_match(volume, searchdict):
    volume_metadata = {}
    for i in volume.get('volume_metadata'):
        volume_metadata[i['key']] = i['value']
    for (k, v) in searchdict.iteritems():
        if ((k not in volume_metadata.keys()) or (volume_metadata[k] != v)):
            return False
    return True
def _check_metadata_match(volume, searchdict):
    volume_metadata = {}
    for i in volume.get('volume_metadata'):
        volume_metadata[i['key']] = i['value']
    for (k, v) in searchdict.iteritems():
        if ((k not in volume_metadata.keys()) or (volume_metadata[k] != v)):
            return False
    return True