def _to_bool(string_value):
  """Convert string to boolean value.

  Args:
    string_value: A string.

  Returns:
    Boolean.  True if string_value is "true", False if string_value is
    "false".  This is case-insensitive.

  Raises:
    ValueError: string_value not "true" or "false".
  """
  string_value_low = string_value.lower()
  if string_value_low not in ('false', 'true'):
    raise ValueError(
        'invalid literal for boolean: %s (must be "true" or "false")' %
        string_value)
  return string_value_low == 'true'