def asbool(val):
    """
    Parse string to bool.
    """
    val = str(val.lower())
    if val in ('1', 't', 'true', 'on'):
        return True
    elif val in ('0', 'f', 'false', 'off'):
        return False
    else:
        raise ValueError()
