def str2bool(val):
    """
    Convert the strings "True" and "False" to the booleans True and False.
    """
    if val == "True":
        return True
    elif val == "False":
        return False
    else:
        raise Exception("unknown string for bool '%s'" % val)