def get_wrong_volume_metadata(meta):
    wrong_metadata = {}
    volume_metadata_t = Table('volume_metadata', meta, autoload=True)
    volumes_t = Table('volumes', meta, autoload=True)
    metadata_join = volume_metadata_t.join(volumes_t, (volume_metadata_t.c.volume_id == volumes_t.c.id))
    columns = [volumes_t.c.id, volumes_t.c.deleted, volume_metadata_t.c.id, volume_metadata_t.c.deleted]
    wrong_volume_metadata_q = select(columns=columns).select_from(metadata_join).where(and_((volumes_t.c.deleted == 1), (volume_metadata_t.c.deleted == 0)))
    for (volume_id, volume_deleted, volume_metadata_id, volume_metadata_deleted) in wrong_volume_metadata_q.execute():
        wrong_metadata[volume_metadata_id] = volume_id
    return wrong_metadata
def get_wrong_volume_metadata(meta):
    wrong_metadata = {}
    volume_metadata_t = Table('volume_metadata', meta, autoload=True)
    volumes_t = Table('volumes', meta, autoload=True)
    metadata_join = volume_metadata_t.join(volumes_t, (volume_metadata_t.c.volume_id == volumes_t.c.id))
    columns = [volumes_t.c.id, volumes_t.c.deleted, volume_metadata_t.c.id, volume_metadata_t.c.deleted]
    wrong_volume_metadata_q = select(columns=columns).select_from(metadata_join).where(and_((volumes_t.c.deleted == 1), (volume_metadata_t.c.deleted == 0)))
    for (volume_id, volume_deleted, volume_metadata_id, volume_metadata_deleted) in wrong_volume_metadata_q.execute():
        wrong_metadata[volume_metadata_id] = volume_id
    return wrong_metadata