def read_bool(data):
   """Reads a string and outputs a boolean.

   Takes a string of the form 'true' or 'false', and returns the appropriate
   boolean.

   Args:
      data: The string to be read in.

   Raises:
      ValueError: Raised if the string is not 'true' or 'false'.

   Returns:
      A boolean.
   """


   if data.strip().upper() == "TRUE":
      return True
   elif data.strip().upper() == "FALSE":
      return False
   else:
      raise ValueError(data + " does not represent a bool value")