def select_multiple_options(options, message='', val=None):
    """ CLI multiple selection given options. """
    
    n_options = len(options)
    valid_selections = False
    selected_options = []
    while not valid_selections:
        for i, opt in enumerate(np.sort(options)):
            logger.info('{}: {}'.format(i, opt))
        val = input(message + ' (space separated selection)\n')
        vals = val.split(' ')
        valid_selections = True
        for v in vals:
            if int(v) not in list(range(n_options)):
                logger.error('Invalid choice.')
                valid_selections = False
            else:
                selected_options.append(options[int(v)])
    
    return selected_options
CLI multiple selection given options.
ISR/utils/utils.py