def BooleanFromString(s):
  """Interpret 's' as a boolean and return its value.  Raise
  ValueError if it's not something we can interpret as true or
  false."""
  s = s.lower()
  if s in ("true", "t", "1", "on", "yes", "y"):
    return True
  if s in ("false", "f", "0", "off", "no", "n"):
    return False
  raise ValueError("'%s' not a valid boolean" % (s,))