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

def _bulk_state(saltfunc, lbn, workers, profile):
    '''
    Generic function for bulk worker operation
    '''
    ret = {'name': lbn,
           'result': True,
           'changes': {},
           'comment': ''}

    if not isinstance(workers, list):
        ret['result'] = False
        ret['comment'] = 'workers should be a list not a {0}'.format(
            type(workers)
        )
        return ret

    if __opts__['test']:
        ret['result'] = None
        return ret

    log.info('executing %s to modjk workers %s', saltfunc, workers)
    try:
        cmdret = __salt__[saltfunc](workers, lbn, profile=profile)
    except KeyError:
        ret['result'] = False
        ret['comment'] = 'unsupported function {0}'.format(
            saltfunc
        )
        return ret

    errors = []
    for worker, ok in six.iteritems(cmdret):
        if not ok:
            errors.append(worker)

    ret['changes'] = {'status': cmdret}
    if errors:
        ret['result'] = False
        ret['comment'] = '{0} failed on some workers'.format(saltfunc)

    return ret