<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_bnum(opts, minions, quiet):
    '''
    Return the active number of minions to maintain
    '''
    partition = lambda x: float(x) / 100.0 * len(minions)
    try:
        if '%' in opts['batch']:
            res = partition(float(opts['batch'].strip('%')))
            if res < 1:
                return int(math.ceil(res))
            else:
                return int(res)
        else:
            return int(opts['batch'])
    except ValueError:
        if not quiet:
            salt.utils.stringutils.print_cli('Invalid batch data sent: {0}\nData must be in the '
                      'form of %10, 10% or 3'.format(opts['batch']))