def validate_bool(args, key, default=None):
    value = validate_exists(args, key, default)
    if value.lower() == 'true':
        return True
    elif value.lower() == 'false':
        return False
    else:
        raise ArgumentError(_("Argument %(key)s may not take value %(value)s. "
                              "Valid values are ['true', 'false'].")
                            % {'key': key,
                               'value': value})
Validates that a string argument to a RPC method call is a boolean
dataset/ETHPy150Open nii-cloud/dodai-compute/plugins/xenserver/xenapi/etc/xapi.d/plugins/pluginlib_nova.py/validate_bool