def process_z_slice_list(img_obj_list, config):
    """Make sure all members of z_slices are part of io_obj.
    If z_slices = 'all', replace with actual list of z_slices

    Parameters
    ----------
    img_obj_list: list
        list of mManagerReader instances
    config: obj
        ConfigReader instance

    Returns
    -------
        img_obj_list: list
        list of modified mManagerReader instances

    """
    n_slice_local_bg = config.processing.n_slice_local_bg
    for idx, io_obj in enumerate(img_obj_list):
        config_z_list = config.dataset.z_slices[idx]
        if not config_z_list[0] == 'all':
            try:
                img_obj_list[idx].z_list = config_z_list
            except Exception as e:
                print('z_slice list {} for sample in {} is invalid'.format(config_z_list, io_obj.img_sm_path))
                ValueError(e)
        if not n_slice_local_bg == 'all':
            # adjust slice number to be multiple of n_slice_local_bg
            img_obj_list[idx].z_list = \
                img_obj_list[idx].z_list[0:len(img_obj_list[idx].z_list) // n_slice_local_bg * n_slice_local_bg]
    return img_obj_list