def str2bool(txt):
    """
    Convert a string to a boolean

    :param txt: string object
    :return: boolean
    """
    if txt.lower() in ['1', 'true', 'yes', 'y']:
        return True
    elif txt.lower() in ['0', 'false', 'no', 'n']:
        return False
    else:
        raise ValueError("Can't convert \"{}\" to a boolean".format(txt))