def str2bool(val):
    """Convert string to boolean value
    """
    try:
        if val.lower() in ['false', 'off', '0']:
            return False
        else:
            return True

    except AttributeError:
        raise TypeError('value {0} was not a string'.format(type(val)))