def str2bool(str_val):
    """
        Convert string to boolean

    :param str_val: boolean in str
    :return: value in bool or raise error if not matched
    """
    state = str_val.strip().lower()
    if state in ('t', 'y', 'true', 'yes', '1'):
        return True
    elif state in ('f', 'n', 'false', 'no', '0', ''):
        return False
    else:
        raise ValueError