diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index b2bda08cb..9937994db 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1272,6 +1272,37 @@ def to_boolean(string, default=None):
     else:
         raise ValueError("Invalid value for to_boolean: %s" % string)
 
+def is_enabled(variable, truevalue, falsevalue, d):
+    """
+    Check the boolean value of the variable.
+
+    Arguments:
+
+    -  ``variable``: the variable name. This will be fetched and expanded (using
+       d.getVar(variable)).
+    -  ``truevalue``: the value to return if the boolean value is True.
+    -  ``falsevalue``: the value to return if the boolean value is False.
+    -  ``d``: the data store.
+
+    Returns ``truevalue`` if the variable boolean value is True, ``falsevalue``
+    otherwise.
+    """
+
+    val = d.getVar(variable)
+    if not val:
+        return falsevalue
+
+    if isinstance(val, int):
+        return truevalue if val else falsevalue
+
+    normalized = val.lower()
+    if normalized in ("y", "yes", "1", "true"):
+        return truevalue
+    elif normalized in ("n", "no", "0", "false"):
+        return falsevalue
+    else:
+        raise ValueError("Invalid value for is_enabled: %s" % val)
+
 def contains(variable, checkvalues, truevalue, falsevalue, d):
     """Check if a variable contains all the values specified.
 
