def bool_value(value, default=False):
    """
    Convert strings like 'yes', 'y', 'true', '1',
    'no', 'n', 'false', '0' or '' to boolean values.
    :param str value: "Value to parse to bool"
    :param bool default: "Default value if unable to convert"
    :rtype: bool
    """
    if not value:
        return default

    true_values = ('yes', 'y', 'true', '1')
    false_values = ('no', 'n', 'false', '0', '')
    normalized_value = value.strip().lower()
    if normalized_value in true_values:
        return True
    elif normalized_value in false_values:
        return False
    else:
        return default
dataset/ETHPy150Open djng/djng/server/core/env_utils.py/bool_value/original