'delete a volume'

def delete_volume_by_name(self, volume):

    modified = False
    exist_volume_mounts = self.get_volume_mounts()
    exist_volumes = self.get_volumes()
    del_idx = None
    for (idx, exist_volume) in enumerate(exist_volumes):
        if (('name' in exist_volume) and (exist_volume['name'] == volume['name'])):
            del_idx = idx
            break
    if (del_idx != None):
        del exist_volumes[del_idx]
        modified = True
    del_idx = None
    for (idx, exist_volume_mount) in enumerate(exist_volume_mounts):
        if (('name' in exist_volume_mount) and (exist_volume_mount['name'] == volume['name'])):
            del_idx = idx
            break
    if (del_idx != None):
        del exist_volume_mounts[idx]
        modified = True
    return modified
