code: def _validate_bool(value):
      
      if isinstance(value, six.text_type):
          if value.strip().lower() == 'true':
              value = True
          elif value.strip().lower() == 'false':
              value = False
          else:
              raise ValueError('"{}" must be a boolean ("True" or "False")'.format(value))
  
      if not isinstance(value, bool):
          raise ValueError('"{}" is not a boolean value.'.format(value))
  
      return value
docs: Validate a setting is a bool.
  
      Returns:
          bool: The value as a boolean.
  
      Raises:
          ValueError: If the value can't be parsed as a bool string or isn't already bool.